在石英调度程序中以固定延迟进行调度?

发布于 2024-10-18 08:34:32 字数 307 浏览 7 评论 0原文

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

我正在使用quartz调度程序使用cron表达式来安排我的工作。有没有办法告诉石英调度程序保留下一次作业运行,直到第一个作业完成?

我正在寻找类似的东西 -

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

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.

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?

I am looking for something similar to -

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

燕归巢 2024-10-25 08:34:32

使用 StatefulJob。来自文档:

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

Use a StatefulJob. From the docs:

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文