Fixed Delay Scheduling with Quartz


With this (Fixed Delay) kind of scheduling there is always a same fixed delay between termination of one execution and commencement of another, as can be shown in the following image.


Java supports this kind of scheduling inherently through java.util.Timer and java.util.concurrent.ScheduledExecutorService, however achieving fix delay using quartz is not that straight forward (Specially when misfires are considered)

One might consider the easy approach, of rescheduling itself from within the execute method of quartz job.


Here is the implementation, you would keep the reschedule method in util class as static method.


However, a better approach would be to use Quartz listeners:


Here is the implementation of the listener


Here is the usage :


Here is the code for and