public void registerTimeout ( final K key , final long delay , final TimeUnit unit ) { Preconditions . checkState ( timeoutListener != null , "The " + getClass ( ) . getSimpleName ( ) + " has not been started." ) ; if ( timeouts . containsKey ( key ) ) { unregisterTimeout ( key ) ; } timeouts . put ( key , new Timeout <> ( timeoutListener , key , delay , unit , scheduledExecutorService ) ) ; }
Register a timeout for the given key which shall occur in the given delay .