man
man

Reputation: 1

about misfire in quartz -scheduler

I am using quart library for scheduling in java. I have written a trigger like this

trigger = newTrigger().withIdentity("myTrigger", "myGroup").startNow() .withSchedule(cronSchedule(croneExpression).withMisfireHandlingInstructionFireAndProceed()) .forJob("myJob","myGroup") .build();

Now when i set the scheduler with cronexpression which is dynamically generated scheduler runs properly. But when server is shutdown during the period in which scheduler is set to fire , the values in quartz_trigger i.e. the next_fire_time in table is changed after the execution time of the job.Because of this the misfire of the scheduler do not work.So my purpose is not solved.So what can be the problem? Is any property in the quartz.properties to be set. I am not using job.xml(jobInitializer) to set the scheduler.

Upvotes: 0

Views: 5840

Answers (1)

Shailesh Pratapwar
Shailesh Pratapwar

Reputation: 4224

the values in quartz_trigger i.e. the next_fire_time in table is changed after the execution >time of the job

Yes, this is quartz actually does in case of misfires.

As per the misfire instruction provided while creating a trigger, quartz calculates how many times the misfired execution has to be executed. As per your code , you have set the misfire instruction as "fireAndProceed" , So Quartz just executes the very first misfired execution ( and neglect all the subsequent remaining misfires). Ex: If you set the trigger to fire between 2Pm to 4pm with interval of 30 min and if scheduler was down during 2:29pm to 3.29pm, then only one trigger execution of time 2.30pm will be executed ( and executions of 3.pm will be neglected).

Hope this answers your question. :-)

Upvotes: 1

Related Questions