public void scheduleAtWithInterval ( final org . easybatch . core . job . Job job , final Date startTime , final int interval ) throws JobSchedulerException { checkNotNull ( job , "job" ) ; checkNotNull ( startTime , "startTime" ) ; String name = job . getName ( ) ; String jobName = JOB_NAME_PREFIX + name ; String triggerName = TRIGGER_NAME_PREFIX + name ; SimpleScheduleBuilder scheduleBuilder = simpleSchedule ( ) . withIntervalInSeconds ( interval ) . repeatForever ( ) ; Trigger trigger = newTrigger ( ) . withIdentity ( triggerName ) . startAt ( startTime ) . withSchedule ( scheduleBuilder ) . forJob ( jobName ) . build ( ) ; JobDetail jobDetail = getJobDetail ( job , jobName ) ; try { LOGGER . info ( "Scheduling job ''{}'' to start at {} and every {} second(s)" , name , startTime , interval ) ; scheduler . scheduleJob ( jobDetail , trigger ) ; } catch ( SchedulerException e ) { throw new JobSchedulerException ( format ( "Unable to schedule job '%s'" , name ) , e ) ; } }
Schedule a job to start at a fixed point of time and repeat with interval period .