示例#1
0
  @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);
    }
  }
示例#2
0
 /* package */ final void subtractCountLocked(final int countLockedToSubtract) {
   try (CloseableReentrantLock l = mutex.open()) {
     _countLocked -= countLockedToSubtract;
   }
 }