In Quartz 1.8.6, is there an option like MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT CronTrigger

♀尐吖头ヾ 提交于 2019-12-11 06:14:15

问题


We're using Quartz 1.8.6 in our app. We are using CronTriggers for hourly and nightly jobs. We would like to set things up such that if there is a misfire, we want to skip the job until the next cron time rolls around.

For simple jobs, it appears you can do a

nightlyTrigger.setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT);

However, it appears that this does not work with CronTrigger. What is the Misfire instruction to use in this case?


回答1:


You want to use CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING.

SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT is telling Quartz that, upon one or more misfires, it must:

  • reschedule the trigger to fire upon the next scheduled date (not firing, i.e. ignoring, missed executions).
  • Also, set the "repetitions left" counter as if all missed executions had run correctly (not accounting for missed runs either).

So basically this misfire instruction tells Quartz to do nothing at all, smile and keep going like nothing ever happened. The KEEP CALM of misfire instructions.

The equivalent instruction for Cron triggers is much more aptly named: CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING.



来源:https://stackoverflow.com/questions/44597977/in-quartz-1-8-6-is-there-an-option-like-misfire-instruction-reschedule-next-wit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!