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

编程入门 行业动态 更新时间:2024-10-10 11:24:35
本文介绍了在石英调度程序中以固定延迟进行调度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我开发了一个作业,我想每 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.

更多推荐

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

本文发布于:2023-11-25 20:53:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1631304.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中以   程序   石英

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!