问题
I'm a project using Spring Roo. I have implemented a scheduler feature on my project following the tutorial about Spring Task Scheduler.
I was planning to add another scheduler but the new scheduler should run at the end of the first scheduler. There's one obvious way for this, to trigger the scheduler method as the last statement of the first scheduler. But that approach would make the first scheduler class dependent on the second scheduler class.
Is there a way to queue two or more schedulers in a way the schedulers are code independent with each other?
回答1:
What you are looking for is job chaining:
http://quartz-scheduler.org/documentation/faq#FAQ-chain
Can Quartz Scheduler Run jobs serially?
You could achieve your goal by using listener that would be notified when job1 is finished and then trigger execution of job2.
来源:https://stackoverflow.com/questions/19246310/queuing-schedular-tasks