I have a Java solution that uses Quartz 2.2.3
, and what I have is:
@DisallowConcurrentExecution
to avoid concurrence, so the same job just can run once per time (OK)This is my problem, I don't want to make the second job wait if the previous didn't finish, I want to skip the second one and when the time turns 3pm
the job can run. Reading javadoc I added the withMisfireHandlingInstructionDoNothing()
but it didn't work.
I think I'm doing something wrong or missing something.
My code:
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();
Change the function :
withMisfireHandlingInstructionDoNothing()
with
withMisfireHandlingInstructionNextWithRemainingCount()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With