Skip to content

Commit

Permalink
Merge pull request #96 from GuanceCloud/liurui
Browse files Browse the repository at this point in the history
修复 ExceptionHistogram 触发 ConcurrentHashMap bug #95
  • Loading branch information
lrwh authored Sep 3, 2024
2 parents 396427b + f6a08b6 commit 742e3b0
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,16 @@ private boolean record(String typeName) {
typeName = CLIPPED_ENTRY_TYPE_NAME;
}

long count = histogram.computeIfAbsent(typeName, k -> new AtomicLong()).getAndIncrement();
// long count = histogram.computeIfAbsent(typeName, k -> new AtomicLong()).getAndIncrement();


AtomicLong atomicLong = histogram.get(typeName);
if (atomicLong==null){
atomicLong = new AtomicLong();

}
long count = atomicLong.getAndIncrement();
histogram.put(typeName,atomicLong);

/*
* This is supposed to signal that a particular exception type was seen the first time in a particular time span.
Expand Down

0 comments on commit 742e3b0

Please sign in to comment.