串行执行不同tasks
一、监听器
使用监听器(TriggerListener, JobListener or SchedulerListener)
通过在 JobListener.jobWasExecuted() 中 立即执行一个新的任务。
这种方法可能侵入性比较强,因为需要在监听器中定义任务的关联关系和需要考虑任务信息的持久化。
One way is to use a listener (i.e. a TriggerListener, JobListener or SchedulerListener) that can notice the completion of a job/trigger and then immediately schedule a new trigger to fire. This approach can get a bit involved, since you’ll have to inform the listener which job follows which and you may need to worry about persistence of this information.
二、使用 JobDataMap
在 JobData 中保存下一个执行任务的标识,在执行的最后执行下一个任务。
Another way is to build a Job that contains within its JobDataMap the name of the next job to fire, and as the job completes (the last step in its Execute() method) have the job schedule the next job.