Downgrade to debug logging and lambda to keep cost down.
@@ -63,9 +63,8 @@ public abstract class AbstractResource implements SharedResource {
activeReferences.add(referenceStack);
state = currentStateDebugWithLock();
}
- log.log(Level.WARNING,
- getClass().getName() + "@" + System.identityHashCode(this) + ".refer(): state={ " + state + " }",
- referenceStack);
+ log.log(Level.FINE, referenceStack, () ->
+ getClass().getName() + "@" + System.identityHashCode(this) + ".refer(): state={ " + state + " }");
return new DebugResourceReference(this, referenceStack);
}
@@ -87,9 +86,8 @@ public abstract class AbstractResource implements SharedResource {
}
doDestroy = activeReferences.isEmpty();
}
- log.log(Level.WARNING,
- getClass().getName() + "@" + System.identityHashCode(this) + " release: state={ " + state + " }",
- releaseStack);
+ log.log(Level.FINE, releaseStack,
+ () ->getClass().getName() + "@" + System.identityHashCode(this) + " release: state={ " + state + " }");
if (doDestroy) {
destroy();
}
