1
votes

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
Would love to, but my vote didn't change the score because I don't have enough stackoverflow karma. I did try though.user2454234

1 Answers

1
votes

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.