Java Code Examples for org.quartz.CronScheduleBuilder#withMisfireHandlingInstructionDoNothing()

The following examples show how to use org.quartz.CronScheduleBuilder#withMisfireHandlingInstructionDoNothing() . 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: ScheduleUtils.java    From supplierShop with MIT License 6 votes vote down vote up
/**
 * 设置定时任务策略
 */
public static CronScheduleBuilder handleCronScheduleMisfirePolicy(SysJob job, CronScheduleBuilder cb)
        throws TaskException
{
    switch (job.getMisfirePolicy())
    {
        case ScheduleConstants.MISFIRE_DEFAULT:
            return cb;
        case ScheduleConstants.MISFIRE_IGNORE_MISFIRES:
            return cb.withMisfireHandlingInstructionIgnoreMisfires();
        case ScheduleConstants.MISFIRE_FIRE_AND_PROCEED:
            return cb.withMisfireHandlingInstructionFireAndProceed();
        case ScheduleConstants.MISFIRE_DO_NOTHING:
            return cb.withMisfireHandlingInstructionDoNothing();
        default:
            throw new TaskException("The task misfire policy '" + job.getMisfirePolicy()
                    + "' cannot be used in cron schedule tasks", Code.CONFIG_ERROR);
    }
}
 
Example 2
Source File: AbstractQuartzTaskManager.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private CronScheduleBuilder handleCronScheduleMisfirePolicy(TaskInfo.TriggerInfo triggerInfo,
                                                            CronScheduleBuilder cb) throws TaskException {
    switch (triggerInfo.getMisfirePolicy()) {
    case DEFAULT:
        return cb;
    case IGNORE_MISFIRES:
        return cb.withMisfireHandlingInstructionIgnoreMisfires();
    case FIRE_AND_PROCEED:
        return cb.withMisfireHandlingInstructionFireAndProceed();
    case DO_NOTHING:
        return cb.withMisfireHandlingInstructionDoNothing();
    default:
        throw new TaskException("The task misfire policy '" + triggerInfo.getMisfirePolicy()
                                        + "' cannot be used in cron schedule tasks",
                                TaskException.Code.CONFIG_ERROR);
    }
}
 
Example 3
Source File: ScheduleUtils.java    From RuoYi-Vue with MIT License 6 votes vote down vote up
/**
 * 设置定时任务策略
 */
public static CronScheduleBuilder handleCronScheduleMisfirePolicy(SysJob job, CronScheduleBuilder cb)
        throws TaskException
{
    switch (job.getMisfirePolicy())
    {
        case ScheduleConstants.MISFIRE_DEFAULT:
            return cb;
        case ScheduleConstants.MISFIRE_IGNORE_MISFIRES:
            return cb.withMisfireHandlingInstructionIgnoreMisfires();
        case ScheduleConstants.MISFIRE_FIRE_AND_PROCEED:
            return cb.withMisfireHandlingInstructionFireAndProceed();
        case ScheduleConstants.MISFIRE_DO_NOTHING:
            return cb.withMisfireHandlingInstructionDoNothing();
        default:
            throw new TaskException("The task misfire policy '" + job.getMisfirePolicy()
                    + "' cannot be used in cron schedule tasks", Code.CONFIG_ERROR);
    }
}
 
Example 4
Source File: ScheduleUtils.java    From ruoyiplus with MIT License 6 votes vote down vote up
public static CronScheduleBuilder handleCronScheduleMisfirePolicy(SysJob job, CronScheduleBuilder cb)
        throws TaskException
{
    switch (job.getMisfirePolicy())
    {
        case ScheduleConstants.MISFIRE_DEFAULT:
            return cb;
        case ScheduleConstants.MISFIRE_IGNORE_MISFIRES:
            return cb.withMisfireHandlingInstructionIgnoreMisfires();
        case ScheduleConstants.MISFIRE_FIRE_AND_PROCEED:
            return cb.withMisfireHandlingInstructionFireAndProceed();
        case ScheduleConstants.MISFIRE_DO_NOTHING:
            return cb.withMisfireHandlingInstructionDoNothing();
        default:
            throw new TaskException("The task misfire policy '" + job.getMisfirePolicy() + "' cannot be used in cron schedule tasks", Code.CONFIG_ERROR);
    }
}
 
Example 5
Source File: ScheduleUtils.java    From LuckyFrameWeb with GNU Affero General Public License v3.0 6 votes vote down vote up
public static CronScheduleBuilder handleCronScheduleMisfirePolicy(Job job, CronScheduleBuilder cb)
        throws TaskException
{
    switch (job.getMisfirePolicy())
    {
        case ScheduleConstants.MISFIRE_DEFAULT:
            return cb;
        case ScheduleConstants.MISFIRE_IGNORE_MISFIRES:
            return cb.withMisfireHandlingInstructionIgnoreMisfires();
        case ScheduleConstants.MISFIRE_FIRE_AND_PROCEED:
            return cb.withMisfireHandlingInstructionFireAndProceed();
        case ScheduleConstants.MISFIRE_DO_NOTHING:
            return cb.withMisfireHandlingInstructionDoNothing();
        default:
            throw new TaskException("The task misfire policy '" + job.getMisfirePolicy() + "' cannot be used in cron schedule tasks", Code.CONFIG_ERROR);
    }
}
 
Example 6
Source File: CronTriggerImpl.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<CronTrigger> getScheduleBuilder() {
    
    CronScheduleBuilder cb = CronScheduleBuilder.cronSchedule(getCronExpression())
            .inTimeZone(getTimeZone());
        
    switch(getMisfireInstruction()) {
        case MISFIRE_INSTRUCTION_DO_NOTHING : cb.withMisfireHandlingInstructionDoNothing();
        break;
        case MISFIRE_INSTRUCTION_FIRE_ONCE_NOW : cb.withMisfireHandlingInstructionFireAndProceed();
        break;
    }
    
    return cb;
}