Quartz默认重启后会执行之前的任务,所以如果不想执行之前漏掉的任务,需要设置一下两个地方:

CRON triggers

CronTrigger trigger = TriggerBuilder.newTrigger()
					.withIdentity(name, TRIGGER_GROUP)
					.withSchedule(
							CronScheduleBuilder.cronSchedule(time)
									.withMisfireHandlingInstructionDoNothing())
					.build();// 触发器名,触发器组,触发器时间设定	

  

withMisfireHandlingInstructionDoNothing(所有的misfire不管,执行下一个周期的任务)

在quartz.properties配置文件中添加:

#这个时间大于10000(10秒)会导致MISFIRE_INSTRUCTION_DO_NOTHING不起作用。

org.quartz.jobStore.misfireThreshold = 1000

 

相关文章:

  • 2022-01-07
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2021-12-02
  • 2021-04-13
  • 2021-07-24
  • 2021-12-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2021-12-23
  • 2022-12-23
相关资源
相似解决方案