protected void postTimeoutProcessing ( TimerImpl timer ) throws InterruptedException { timer . lock ( ) ; try { TimerState timerState = timer . getState ( ) ; if ( timerState != TimerState . CANCELED && timerState != TimerState . EXPIRED ) { if ( timer . getInterval ( ) == 0 ) { timerService . expireTimer ( timer ) ; } else { timer . setTimerState ( TimerState . ACTIVE , null ) ; } timerService . persistTimer ( timer , false ) ; } } finally { timer . unlock ( ) ; } }
After running the timer calculate the new state or expire the timer and persist it if changed . The method must lock the timer for state check and updates if overridden .