@Override public void unlockAll() { assertHasRealOwner(); try (CloseableReentrantLock l = mutex.open()) { // Mark it as closed. // If it was already closed, do nothing. if (closed.getAndSet(true)) { throw new LockAlreadyClosedException(this); } final LockOwner ownerCurrent = getOwner(); final int countUnlocked = Services.get(ILockManager.class).unlock().setOwner(ownerCurrent).release(); subtractCountLocked(countUnlocked); } }
/* package */ final void subtractCountLocked(final int countLockedToSubtract) { try (CloseableReentrantLock l = mutex.open()) { _countLocked -= countLockedToSubtract; } }