2

I am new Quartz scheduler and having some trouble.

When I use simple Scheduler as follows:

Trigger misFiredTriggerB = TriggerBuilder.newTrigger().startAt(DateUtils.addSeconds(new Date(), -63)).withSchedule(SimpleScheduleBuilder.simpleSchedule().withMisfireHandlingInstructionFireNow()).build();

it works fine, considers the misfire threshold and misfire instruction depending on case.

However when I use cron scheduler and use the time few seconds before the current time, it neither consider threshold nor the misfire instruction.

Trigger misFiredTriggerA =  TriggerBuilder.newTrigger().withIdentity("SimpleTrigger").withSchedule(CronScheduleBuilder.cronSchedule("30,35,38 50 17 * * ?").withMisfireHandlingInstructionFireAndProceed()).build();

Is there anything that I am doing wrong with cron?

Another question is how can I easily change the misfire threshold value in eclipse cause by default it is set to 60000?

Thank you in advance.

1 Answers1

0

There is a difference between Simple and Cron triggers.

  • Simple Trigger execution is scheduled for exact date that can be before or after now. In your case it is more than 60 seconds (property org.quartz.jobStore.misfireThreshold (in milliseconds)) before now, so Quartz assumes such trigger as misfired.
  • Quartz uses Cron Trigger to schedule execution for the nearest date in future that respects cron expression. So in your case job will be triggered tomorrow at 17:50:30
Nazar
  • 591
  • 2
  • 8
  • 17