@ Override public void afterCompletion ( int status ) { if ( status == Status . STATUS_COMMITTED ) { Boolean previous = persistentExecutor . inMemoryTaskIds . put ( taskId , Boolean . TRUE ) ; if ( previous == null ) { long delay = expectedExecTime - new Date ( ) . getTime ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Schedule " + taskId + " for " + delay + "ms from now" ) ; persistentExecutor . scheduledExecutor . schedule ( this , delay , TimeUnit . MILLISECONDS ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Found task " + taskId + " already scheduled" ) ; } } }
Upon successful transaction commit automatically schedules a task for execution in the near future .