我有一个使用的Java解决方案Quartz 2.2.3,而我拥有的是:
@DisallowConcurrentExecution以避免并发,因此同一作业每次只能运行一次(确定)这是我的问题,如果前一个任务没有完成,我不想等待第二个任务,我想跳过第二个任务,并且当时间到时3pm该任务可以运行。阅读javadoc时,我添加了,withMisfireHandlingInstructionDoNothing()但是没有用。
我想我做错了什么或缺少了什么。
我的代码:
Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
JobDetail job = JobBuilder.newJob(TestCronService.class).withIdentity("testA","testB").build();
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity("testA","testB")
.withSchedule(CronScheduleBuilder.cronSchedule("0 0 * * * ?")
.withMisfireHandlingInstructionDoNothing())
.build();
scheduler.scheduleJob(job, trigger);
scheduler.start();
Run Code Online (Sandbox Code Playgroud)
小智 5
更改功能:
withMisfireHandlingInstructionDoNothing()
Run Code Online (Sandbox Code Playgroud)
与
withMisfireHandlingInstructionNextWithRemainingCount()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3183 次 |
| 最近记录: |