Ensure lock is cleared when lease is invalidated
@@ -336,8 +336,9 @@ class SingletonManager {
shouldBeActive = false;
}
}
- if (active && ! shouldBeActive) {
+ if ( ! shouldBeActive) {
logger.log(FINE, () -> "Doom value is " + doom);
+ if (active) {
try {
if (!singletons.isEmpty()) metrics.deactivation(singletons.peek()::deactivate);
active = false;
@@ -345,6 +346,7 @@ class SingletonManager {
catch (RuntimeException e) {
logger.log(WARNING, "Failed to deactivate " + singletons.peek(), e);
}
+ }
unlock();
}
}
