根据执行的作业总数暂停作业执行 -quartz
是否可以将 CronTrigger
状态更改为 WAITING
或其他某个值,以停止作业执行直到第二天?我可以暂停触发器,这将停止作业执行,但随后我必须手动恢复此触发器。
实际上,我有一个 CronTrigger,它每天在上午 8:00 - 中午 12:00 之间执行作业,现在它工作正常,但现在我想添加一个附加检查,在执行每个作业之前它会检查作业总数执行作业,如果达到执行作业总数限制,则暂停执行直到第二天。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要创建一个自定义 TriggerListener,它可以跟踪计数,可以否决作业执行,并重新安排第二天的作业(例如,在离开时将触发器的 startTime 更新为第二天的“00:00:00”) cron 表达式相同)。
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).