I'm looking for a way to simulate or force a trigger misfire programatically. Here's the scenario:
I have a job set to trigger but the job requires some underlying resource that may be unavailable at times. If the resource is unavailable, I would like Quartz to re-fire the trigger later based on the misfire policy.
I've explored two options that are similar but not quite what I'm looking for:
1. Throwing a JobExecutionException with refireImmediately set to true: Works, but doesn't delay execution based on misfire policy; this would hammer the resource availability check.
2. Scheduling a second trigger at some fixed interval of time in the future: Also works, but doesn't take into account misfire policy. This means a job could wind up with a bunch of retries queued up stemming from different failed runs.
I'm testing the same situation with no success. Tried to use Scheduler.pauseAll()/resumeAll() - according to Javadocs "If any Trigger missed one or more fire-times, then the Trigger's misfire instruction will be applied.", but the misfire rule wasn't applied (it's MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT).