org.quartz.SimpleScheduleBuilder#withMisfireHandlingInstructionNowWithRemainingCount ( )源码实例Demo

下面列出了org.quartz.SimpleScheduleBuilder#withMisfireHandlingInstructionNowWithRemainingCount ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

private SimpleScheduleBuilder handleSimpleScheduleMisfirePolicy(TaskInfo.TriggerInfo triggerInfo,
                                                                SimpleScheduleBuilder sb) throws TaskException {
    switch (triggerInfo.getMisfirePolicy()) {
    case DEFAULT:
        return sb;
    case FIRE_NOW:
        return sb.withMisfireHandlingInstructionFireNow();
    case IGNORE_MISFIRES:
        return sb.withMisfireHandlingInstructionIgnoreMisfires();
    case NEXT_WITH_EXISTING_COUNT:
        return sb.withMisfireHandlingInstructionNextWithExistingCount();
    case NEXT_WITH_REMAINING_COUNT:
        return sb.withMisfireHandlingInstructionNextWithRemainingCount();
    case NOW_WITH_EXISTING_COUNT:
        return sb.withMisfireHandlingInstructionNowWithExistingCount();
    case NOW_WITH_REMAINING_COUNT:
        return sb.withMisfireHandlingInstructionNowWithRemainingCount();
    default:
        throw new TaskException("The task misfire policy '" + triggerInfo.getMisfirePolicy()
                                        + "' cannot be used in simple schedule tasks",
                                TaskException.Code.CONFIG_ERROR);
    }
}
 
源代码2 项目: lams   文件: SimpleTriggerImpl.java
/**
 * Get a {@link ScheduleBuilder} that is configured to produce a 
 * schedule identical to this trigger's schedule.
 * 
 * @see #getTriggerBuilder()
 */
@Override
public ScheduleBuilder<SimpleTrigger> getScheduleBuilder() {
    
    SimpleScheduleBuilder sb = SimpleScheduleBuilder.simpleSchedule()
    .withIntervalInMilliseconds(getRepeatInterval())
    .withRepeatCount(getRepeatCount());
    
    switch(getMisfireInstruction()) {
        case MISFIRE_INSTRUCTION_FIRE_NOW : sb.withMisfireHandlingInstructionFireNow();
        break;
        case MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT : sb.withMisfireHandlingInstructionNextWithExistingCount();
        break;
        case MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT : sb.withMisfireHandlingInstructionNextWithRemainingCount();
        break;
        case MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT : sb.withMisfireHandlingInstructionNowWithExistingCount();
        break;
        case MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT : sb.withMisfireHandlingInstructionNowWithRemainingCount();
        break;
    }
    
    return sb;
}