private void estimateNextExecution ( ) { synchronized ( TIMER_LOCK ) { if ( fixedDelay ) { scheduledExecutionTime = period + System . currentTimeMillis ( ) ; } else { if ( firstExecution == 0 ) { // save timestamp of first execution firstExecution = scheduledExecutionTime ; } long now = System . currentTimeMillis ( ) ; long executedTime = ( numInvocations ++ * period ) ; scheduledExecutionTime = firstExecution + executedTime ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "next execution estimated to run at " + scheduledExecutionTime ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "current time is " + now ) ; } } } }
Helper to calculate when next execution time is .