在石英调度程序中以固定延迟进行调度? [英] Scheduled with fixed delay in quartz scheduler?

查看:56
本文介绍了在石英调度程序中以固定延迟进行调度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个作业,我想每 5 分钟运行一次,但在某些情况下,作业完成时间可能会超过 5 分钟.

I have developed a job which I want to run say after every 5 mins, but there may be certain circumstances where the job completion time may exceeds 5 mins.

我正在使用石英调度程序使用 cron 表达式来安排我的工作.有什么办法可以告诉quartz scheduler 等待下一个作业运行,直到第一个作业完成?

I am using quartz scheduler to schedule my job using a cron expression. Is there any way to tell quartz scheduler to hold the next run of job untill first one is completed?

我正在寻找类似于 -

private static final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
executor.scheduledWithFixedDelay(..);

推荐答案

使用 有状态作业.来自文档:

不允许有状态的作业并发执行,这意味着新的触发之前发生的execute(xx) 方法完成会延迟.

stateful jobs are not allowed to execute concurrently, which means new triggers that occur before the completion of the execute(xx) method will be delayed.

这篇关于在石英调度程序中以固定延迟进行调度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆