Quartz Cron Trigger with Spring - 在上次结束之前触发新的 cron

发布于 2024-08-27 09:46:21 字数 222 浏览 4 评论 0原文

我认为很简单的问题。

我有 org.springframework.scheduling.quartz.CronTriggerBean 每天触发一项作业。因为这种方式可以持续很长时间(超过24小时),如果上一个作业还没有结束,第二天同一时间是否会执行新的作业?

如果是,是否可以关闭执行新作业,直到最后一个作业完成?

我的方法是对视频进行转码,有时会有很多视频并且可以持续很长时间。

Simple question, I think.

I have org.springframework.scheduling.quartz.CronTriggerBean triggering one job once a day. Because this method can last a long time (over 24 hours), will the next day at the same time a new job be executed if the last one is not ended yet?

If yes - is it possible to turn off executing new jobs until the last one is finished?

My method is trans-coding videos and some days there a lot of videos and could last long.

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

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

发布评论

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

评论(1

陪你搞怪i 2024-09-03 09:46:21

使作业有状态,因此它将在作业的前一个实例结束之前阻止新实例。

您可以通过让 Job 实现 StatefulJob 接口来将其“标记”为有状态。
您将在此处了解有关有状态作业的更多信息

Make the Job stateful, So it will prevent the new instance before the previous instance of the job ended.

You 'mark' a Job as stateful by having it implement the StatefulJob interface.
You will get more about stateful job here

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