I’m writing to address an issue we’re facing with the Quartz Scheduler. Currently, we’re observing that jobs are triggering instantly instead of following the provided Cron expression.
As I am scheduling the job through the database, whenever the data is saved in the database, it gets triggered automatically first, and then the second fire occurs according to the provided Cron expression.
For your reference I am sharing the details and scenario regarding this :
I am setting the following values in DB:
qrtzTrigger.setStartTime(currentTimeMillis);
qrtzTrigger.setNextFireTime(-1); or value :0
qrtzTrigger.setPrevFireTime( -1); or value :0
qrtzTrigger.setPriority(5);
qrtzTrigger.setEndTime(0L);
qrtzTrigger.setMisfireInstr(0);
However, this configuration doesn’t seem to prevent instant triggering.
And the scenario is like :
- Cron Expression: 0 37 0 2,3 * ? *
- Next/Prev Fire Date: 0
- State: Waiting
**Data saved in database at : 2024-05-02 00:33:31.748
**Job Execution Time : 2024-05-02 00:33:49.579
After the first job execution:
- Next Fire Date: 02/05/2024 00:37:00
- Prev Fire Date: 02/05/2024 00:33:48
After the second job execution:
**Job Execution Time : 2024-05-02 00:37:00.221
- Next Fire Date: 03/05/2024 00:37:00
- Last Fire Date: 02/05/2024 00:37:00
Could you please help us understand why this is happening and suggest a solution?
Response for this as soon as possible will be highly appreciated.
Thanks.