public void alarm ( final Object context ) { long sleepInterval = 0 ; do { long startWakeUpTime = System . currentTimeMillis ( ) ; try { wakeUp ( startDaemonTime , startWakeUpTime ) ; } catch ( Exception ex ) { com . ibm . ws . ffdc . FFDCFilter . processException ( ex , "com.ibm.ws.cache.RealTimeDaemon.alarm" , "83" , this ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "exception during wakeUp" , ex ) ; } sleepInterval = timeInterval - ( System . currentTimeMillis ( ) - startWakeUpTime ) ; // keep looping while we are behind... (i.e. execution time is greater than the time interval) } while ( sleepInterval <= 0 ) ; if ( false == stopDaemon ) { Scheduler . createNonDeferrable ( sleepInterval , context , new Runnable ( ) { @ Override public void run ( ) { alarm ( context ) ; } } ) ; } }
It runs in a loop that tries to wake every timeInterval . If it gets behind due to an overload the subclass implementation of the wakeUp method is responsible for resynching itself based on the startDaemonTime and startWakeUpTime .