NutzCN Logo
问答 怎样比较好的方式配置SimpleTrigger
发布于 2351天前 作者 qq_8c799e25 1850 次浏览 复制 上一个帖子 下一个帖子
标签:

想用quartz提供其它trigger模式,默认是 private int misfireInstruction = SimpleTrigger.MISFIRE_INSTRUCTION_SMART_POLICY;

var ioc = {
   "scheduler" :{
      "type" :"org.quartz.Scheduler",
      "factory" :"org.quartz.impl.StdSchedulerFactory#getDefaultScheduler",
      "events" :{
         "create" :"start",
         "depose" :"shutdown"
      },
      "fields" :{
         "jobFactory" :{
            "refer" :"jobFactory"
         }
      }
   },
   "jobFactory" :{
      "type" :"org.nutz.integration.quartz.NutQuartzJobFactory",
      "args" :[{
         "refer" :"$ioc"
      }]
   },
   "nutQuartzCronJobFactory" :{
      "type" :"org.nutz.integration.quartz.NutQuartzCronJobFactory",
      "events" :{
         "create" :"init"
      },
      "fields" :{
         "scheduler" :{
            "refer" :"scheduler"
         },
         "conf" :{
            "refer" :"@confName"
         }
      }
   },
   "quartzManager" : {
	   "type" :"org.nutz.integration.quartz.QuartzManagerImpl",
	   "fields" :{
	         "scheduler" :{
	            "refer" :"scheduler"
	         }
	    }
   }
};

怎么在ioc中配置呢,需要从头自定义Scheduler吗?

3 回复

其实就是想把SimpleScheduleBuilder 里的调用withMisfireHandlingInstructionNextWithExistingCount()

@IocBean
public class MyBeans {

    @IocBean(name="scheduler", create="start", depose="shutdown") 
    public Scheduler createScheduler(@Inject JobFactory jobFactory) {
             // 写你想要的代码
    }
}

添加回复
请先登陆
回到顶部