示例#1
0
  void onTimeout(int hand) {
    final ReentrantLock lock = m_lock;
    // If the lock cannot be acquired, which means this notifier is being
    // cancelled or rescheduled or closed, just skip.
    if (!lock.tryLock()) return;

    try {
      // If this notifier is not in the same timeout sublist,
      // which means it has been cancelled or rescheduled,
      // then skip.
      TimeoutEvent event = m_node.get();
      if (event == null || hand != event.getIndex()) return;

      if (event.getTimeLeft() < 1) {
        changeState(TimedOut.getInstance());
        m_admin.fireTimeout(this);
      } else m_admin.scheduleNextRound(this);
    } finally {
      lock.unlock();
    }
  }