Springboot Qaurtz Scheduler skips the next fire time

Viewed 74

I am using Quartz Scheduler to schedule some Jobs, when I was using a simple trigger for hourly and daily intervals it was working fine.

For Monthly and Yearly schedules I moved to Cron Scheduler, it always skips the next fire time If I schedule for Feb 10, but it starts from Mar 10 if I use to run every 2 months it starts on April 10

I tried

0 0 0 10 JAN-DEC/2 ?

Also with

0 0 0 10 */2 ?

Code I use to create the Job trigger

  trigger.withSchedule(cronSchedule(cornExpression)
      .inTimeZone(TimeZone.getDefault())
      .withMisfireHandlingInstructionDoNothing()).startAt(schedulerOptions.getStartsAt());

Value of schedulerOptions.getStartsAt()

Thu Feb 10 20:00:00 IST 2022

the trigger is TriggerBuilder

Here are the Debugger Values of the Trigger Object

enter image description here

After creating the Trigger, I checked for the next fire time, it skipped the next month, below is the debug value of the nextfiretime

enter image description here

0 Answers
Related