Example usage for org.springframework.scheduling.quartz CronTriggerFactoryBean setMisfireInstruction

List of usage examples for org.springframework.scheduling.quartz CronTriggerFactoryBean setMisfireInstruction

Introduction

In this page you can find the example usage for org.springframework.scheduling.quartz CronTriggerFactoryBean setMisfireInstruction.

Prototype

public void setMisfireInstruction(int misfireInstruction) 

Source Link

Document

Specify a misfire instruction for this trigger.

Usage

From source file:com.wiiyaya.provider.main.utils.BatchHelper.java

public static CronTriggerImpl getCronTrigger(Batch task) {
    try {/*from  ww  w .ja v  a  2 s  .  co m*/
        CronTriggerFactoryBean cronTriggerFactoryBean = new CronTriggerFactoryBean();
        cronTriggerFactoryBean.setBeanName(task.getTaskName());
        cronTriggerFactoryBean.setJobDetail(getJobDetail(task));
        cronTriggerFactoryBean.setMisfireInstruction(task.getMisfireType().getInstruction());
        cronTriggerFactoryBean.setCronExpression(task.getCronExpression());
        cronTriggerFactoryBean.afterPropertiesSet();
        CronTriggerImpl cronTriggerImpl = (CronTriggerImpl) cronTriggerFactoryBean.getObject();
        if (task.getStartDate() != null) {
            cronTriggerImpl.setStartTime(task.getStartDate());
        }
        if (task.getEndDate() != null) {
            cronTriggerImpl.setEndTime(task.getEndDate());
        }
        if (task.isHolidayRest()) {
            //TODO
        }
        return cronTriggerImpl;
    } catch (ParseException e) {
        return null;
    }
}