Pre-increment leakCheckCnt to prevent false leak-detectation for very first time
Motivation: ResourceLeakDetector reports leak for first call to open(obj) as its leakCheckCnt starts with value 0 and increment subsequently. with value of leakCheckCnt =0, it always returns ResourceLeak. Our application calls ResourceLeakDetector.open(obj) to validate Leak and it fails at very first call even though there is no leak in application. Modifications: ResourceLeakDetector.leakCheckCnt value will not be 0 while deriving leak and it will not return incorrect value of ResourceLeak. Result: Fix false leak report on first call on ResourceLeakDetector.
This commit is contained in:
parent
149916d052
commit
789c9a53df
@ -221,7 +221,7 @@ public class ResourceLeakDetector<T> {
|
||||
}
|
||||
|
||||
if (level.ordinal() < Level.PARANOID.ordinal()) {
|
||||
if ((leakCheckCnt ++ & mask) == 0) {
|
||||
if ((++ leakCheckCnt & mask) == 0) {
|
||||
reportLeak(level);
|
||||
return new DefaultResourceLeak(obj);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user