1

I have developed a job which I want to run say after every 5 mins, but there may be certain circumstances where the job completion time may exceeds 5 mins.

I am using quartz scheduler to schedule my job using a cron expression. Is there any way to tell quartz scheduler to hold the next run of job untill first one is completed?

I am looking for something similar to -

private static final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
executor.scheduledWithFixedDelay(..);
dogbane
  • 266,786
  • 75
  • 396
  • 414
user381878
  • 1,543
  • 5
  • 17
  • 30

2 Answers2

4

Use a StatefulJob. From the docs:

stateful jobs are not allowed to execute concurrently, which means new triggers that occur before the completion of the execute(xx) method will be delayed.

dogbane
  • 266,786
  • 75
  • 396
  • 414