Task will never fire again if I reboot my program. I follow the code of RedisJobStore and find that the trigger has 2 states, which are waiting and acquired(the redis key is prefix_acquired_triggers and prefix_waiting_triggers). If the task state was acquired when I shutdown my program, then QuartzSchedulerThread couldn't get the waiting triggers and couldn't fire the task.
The code of QuartzSchedulerThread is the following:
The QuartzSchedulerThread will get triggers with waiting state and convert its waiting state to acquired state.(delete it and then add it)
And in the below, the QuartzSchedulerThread fires the task and then converts its acquired state to a waiting state.
QuartzSchedulerThread will repeat the action over and over again.
However:
When I reboot my program and the state of task is acquired, and then the first step can't get the task so that the task will never be fired again.
PS: I found the task will be fired again after my program starts 5-10 minutes(The cron of my task is 0/5 * * * * ?).
Why can't the task recover right away when my program starts? And what should I do?
Task will never fire again if I reboot my program. I follow the code of
RedisJobStore
and find that the trigger has 2 states, which arewaiting
andacquired
(the redis key isprefix_acquired_triggers
andprefix_waiting_triggers
). If the task state wasacquired
when I shutdown my program, thenQuartzSchedulerThread
couldn't get the waiting triggers and couldn't fire the task.The code of
QuartzSchedulerThread
is the following:QuartzSchedulerThread
will get triggers with waiting state and convert its waiting state to acquired state.(delete it and then add it)And in the below, the
QuartzSchedulerThread
fires the task and then converts its acquired state to a waiting state.QuartzSchedulerThread
will repeat the action over and over again.However: When I reboot my program and the state of task is acquired, and then the first step can't get the task so that the task will never be fired again.
PS: I found the task will be fired again after my program starts 5-10 minutes(The cron of my task is
0/5 * * * * ?
).Why can't the task recover right away when my program starts? And what should I do?