Quartz sets misfire policy

  quartz

Order

Quartz provides different misfire handling strategies for different trigger. The default is Misfire _ Instruction _ Smart _ Policy. Here’s how to set up your personality.

Mode 1: strong transfer setting

SimpleTrigger trigger = (SimpleTrigger) newTrigger()
                .withIdentity("trigger1", "group1")
                //如果你没有调用 *startAt(..)*方法,那么当前时间(立刻激活)将被赋值。
                .startAt(startTime)
                .build();
        ((SimpleTriggerImpl)trigger).setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT);

Mode 2: Streaming api Settings

SimpleTrigger trigger1 = newTrigger().withIdentity("trigger1", "group1").startAt(startTime)
                .withSchedule(simpleSchedule()
                        .withIntervalInSeconds(10)
                        .withRepeatCount(4)
                        .withMisfireHandlingInstructionNowWithRemainingCount())
                .build();

Or ..

CronTrigger trigger = newTrigger()
                .withIdentity("trigger1", "group1")
                .withSchedule(cronSchedule("0/20 * * * * ?")
                .withMisfireHandlingInstructionDoNothing())
                .build();