public void addListener(final TimeoutEventListener listener){
  final long timeout=listener.getTimeout();
  if (timeout > 0) {
    listeners.add(listener);
synchronized (stateLock) {
      pendingListenerMinDelay=Math.min(pendingListenerMinDelay,timeout);
      stateLock.notifyAll();
    }
  }
}

public void addListener ( final TimeoutEventListener listener ) { final long timeout = listener . getTimeout ( ) ; if ( timeout > 0 ) { listeners . add ( listener ) ; synchronized ( stateLock ) { pendingListenerMinDelay = Math . min ( pendingListenerMinDelay , timeout ) ; stateLock . notifyAll ( ) ; } } }
registers a timeout event listener for timeout notification .
