Java Code Examples for org.quartz.SimpleScheduleBuilder#withMisfireHandlingInstructionNowWithExistingCount()

The following examples show how to use org.quartz.SimpleScheduleBuilder#withMisfireHandlingInstructionNowWithExistingCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractQuartzTaskManager.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
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);
    }
}
 
Example 2
Source File: SimpleTriggerImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}