@ PostConstruct public void setupScheduler ( ) { for ( SchedulerTask task : tasks ) { if ( task . getDelay ( ) > 0 && task . getInterval ( ) > 0 ) { executor . scheduleWithFixedDelay ( task . getTask ( ) , task . getDelay ( ) , task . getInterval ( ) , task . getTimeUnit ( ) ) ; } else if ( task . isImmediate ( ) && task . getInterval ( ) > 0 ) { executor . scheduleWithFixedDelay ( task . getTask ( ) , 0l , task . getInterval ( ) , task . getTimeUnit ( ) ) ; } else if ( task . getDelay ( ) > 0 ) { executor . schedule ( task . getTask ( ) , task . getDelay ( ) , task . getTimeUnit ( ) ) ; } else { executor . execute ( task . getTask ( ) ) ; } } }
Schedules all tasks injected in by guice .