Alex Rivera | Logout

Ensure that Spring Quartz job execution doesn't overlap

Asked 2009-10-28T11:00:38.380
51

I have a Java program that executes from Spring Qquartz every 20 seconds. Sometimes it takes just few seconds to execute, but as data gets bigger I'm sure it run for 20 seconds or more.

How can I prevent Quartz from firing/triggering the job while one instance is still being executed? Firing 2 jobs performing same operations on a database would not be so good. Is there a way I can do some kind of synchronization?

Edit
Report

1 Answer

1

You can use a semaphore. When the semaphore is taken, abandon the 2nd job and wait until the next fire time.

answered 2009-10-28T11:58:30.630

Your Answer