JBeret ejb scheduler supports repeating interval job executions, with a fixed interval duration or certain delay duration after the start of job execution. Delay after end of a job execution is currently not supported. If your job execution duration is relatively predictable, you can approximate it with either interval or delay after the start of a job execution.
To achieve this kind of job schedulgin with finer control, you can try the following:
- schedule a single-action job schedule
- configure a job listener in job.xml to watch for the end of the above job execution, and scheule the next single-action job execution with a short initial delay
- specifically, the job listener's
afterJob()
method should be able to look up or inject TimerSchedulerBean
, which is a local singleton EJB, and invoke its org.jberet.schedule.TimerSchedulerBean#schedule
method. The job listener is reponsible for creating an instance of org.jberet.schedule.JobScheduleConfig
, passing it when calling the ejb business method. The job listener should already have all info to create JobScheduleConfig
.