public synchronized void timeout ( final TimeoutTask timeoutTask , long timeout ) { TimerTask task = this . tasks . get ( timeoutTask ) ; if ( task != null ) { task . cancel ( ) ; this . tasks . values ( ) . remove ( task ) ; } task = new TimeoutTaskImpl ( timeoutTask ) ; this . tasks . put ( timeoutTask , task ) ; this . timer . schedule ( task , timeout ) ; }
Schedule timeout task reseting timeout period if given timeout task is already pending .