Is it possible in Quartz-Scheduler, to define execution constraints about job ?
Indeed, I have two class which implements interface Job : JobA and JobB.
JobA will be scheduled every minute. JobB will be scheduled every hour.
I doesn't want JobA and JobB run simultaneously.
Note : JobA and JobB doesn't do the same things.
Thanks for your answers.
There is no direct support for that. If it was the same job, you could define it as stateful - such jobs can't run concurrently be definition.
Otherwise you can limit the number of Quartz worker threads to 1, additionally you can define thread priorities to choose which job should run first. Unfortunately this solution won't scale to when more jobs are involved.
Finally you can implement this manually without involving Quartz. I guess you don't want some operation or some resource to be accessed at the same time. Consider locking that method/resource so that both jobs run simultaneously, but one blocks and waits for the other to finish.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With