开发者

pausing job execution based on total number of jobs executed - quartz

开发者 https://www.devze.com 2023-03-17 03:44 出处:网络
Is it possible to change the CronTrigger state to WAITING or to some other value which stops the job execution till next day? I can pause the trigger which will stop开发者_运维问答 job execution but t

Is it possible to change the CronTrigger state to WAITING or to some other value which stops the job execution till next day? I can pause the trigger which will stop开发者_运维问答 job execution but then I have to manual resume this trigger.

Actually, I have a CronTrigger which executes job every day between say 8:00 AM - 12:00 PM, right now it's working fine but now I would like to add an aditional check that before executing every job it will check the total number of jobs executed and pause the execution till next day if the total executed jobs limit is reached.


You'll want to create a custom TriggerListener, which keeps track of the count, can veto job execution, and reschedules jobs for the next day (e.g. updates the triggers' startTime to "00:00:00" of the next day while leaving the cron expression to the same).

0

精彩评论

暂无评论...
验证码 换一张
取 消