Reputation: 23913
I have Quartz
running in a cluster and I do get jobs running periodically. The job is started in one machine and the others will hold until next execution time.
What I want now is to delay the job invocation if the previous invocation isn't finished yet. For instance:
10:00 - instance invocation#1
10:06 - invocation#1 finished
10:10 - instance invocation#2
10:13 - invocation#2 finished
10:20 - instance invocation#3
10:31 - invocation#3 finished // took longer than expected
10:31 - instance invocation#4 // start delayed
10:35 - invocation#4 finished
Even this would be acceptable:
10:00 - instance invocation#1
10:06 - invocation#1 finished
10:10 - instance invocation#2
10:13 - invocation#2 finished
10:20 - instance invocation#3
10:31 - invocation#3 finished // took longer than expected
10:40 - instance invocation#4 // waits for next timed invocation
10:44 - invocation#4 finished
I'm using cron expression like triggers and it is triggered once each 10 minutes (0 0/10 * * *
).
Upvotes: 0
Views: 354
Reputation: 1915
Annotating your job with @DisallowConcurrentExecution
should do the trick.
Upvotes: 1