コード例 #1
0
 @Override
 public void run() {
   try {
     ClientLockManagerImpl.this.recall(session, lock, level, -1, batch);
   } catch (TCNotRunningException e) {
     logger.info(
         "Ignoring "
             + e.getMessage()
             + " in "
             + this.getClass().getName()
             + " and cancelling timer task");
   }
 }
コード例 #2
0
    @Override
    public void run() {
      try {
        int gcCount = 0;
        for (final Entry<LockID, ClientLock> entry : ClientLockManagerImpl.this.locks.entrySet()) {
          ClientLockManagerImpl.this.stateGuard.readLock().lock();
          try {
            if (ClientLockManagerImpl.this.state != State.RUNNING) {
              return;
            }

            final LockID lock = entry.getKey();
            final ClientLock lockState = entry.getValue();
            if (lockState == null) {
              continue;
            }

            if (lockState.tryMarkAsGarbage(ClientLockManagerImpl.this.remoteLockManager)
                && ClientLockManagerImpl.this.locks.remove(lock, lockState)) {
              gcCount++;
            }
          } finally {
            ClientLockManagerImpl.this.stateGuard.readLock().unlock();
          }
        }
        if (gcCount > 0) {
          ClientLockManagerImpl.this.logger.info("Lock GC collected " + gcCount + " garbage locks");
        }

        if (gcCount > GCED_LOCK_THRESHOLD) {
          for (LockEventListener lockGCEventListener : lockEventListeners) {
            lockGCEventListener.fireLockGCEvent(gcCount);
          }
        }
      } catch (TCNotRunningException e) {
        logger.info(
            "Ignoring "
                + e.getMessage()
                + " in "
                + this.getClass().getName()
                + " and cancelling timer task");
      }
    }