石英作业多次触发

发布于 2024-08-26 22:16:12 字数 194 浏览 12 评论 0原文

我有一个构建块,用于设置 Quartz 作业以每天早上发送电子邮件。这项工作每天早上都会被解雇三次,而不是一次。我们有一个托管的 Blackboard 实例,据我所知,它在三个虚拟服务器上运行。我猜测这就是导致问题的原因,因为构建块之前在单个服务器安装上运行良好。

有没有人有 Quartz 经验,或者可以建议如何防止该工作多次触发?

谢谢,

I have a building block which sets up a Quartz job to send out emails every morning. The job is fired three times every morning instead of once. We have a hosted instance of Blackboard, which I am told runs on three virtual servers. I am guessing this is what is causing the problem, as the building block was previously working fine on a single server installation.

Does anyone have Quartz experience, or could suggest how one might prevent the job from firing multiple times?

Thanks,

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

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

发布评论

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

评论(3

浮世清欢 2024-09-02 22:16:12

您没有详细描述您的 Quartz 实例是如何实例化和启动的,但请注意,如果您同时针对同一个作业存储数据库运行多个 Quartz 实例,将会导致未定义的行为,除非您启用集群(请参阅http://www.quartz-scheduler。 org/docs/configuration/ConfigJDBCJobStoreClustering.html)。

You didn't describe in detail how your Quartz instance(s) are being instantiated and started, but be aware that undefined behavior will result if you run multiple Quartz instances against the same job store database at the same time, unless you enable clustering (see http://www.quartz-scheduler.org/docs/configuration/ConfigJDBCJobStoreClustering.html).

萧瑟寒风 2024-09-02 22:16:12

我想我对此的回应有点晚了,但我们的应用程序也有类似的情况。我们有 4 台服务器运行作业,其中一些可以在多台服务器上同时运行,有些只能运行一次。正如 Will 的回复所说,您可以查看 Quartz 的集群功能。

我们的方法有点不同,因为在转向 Quartz 之前我们已经有了自己开发的解决方案。我们的作业利用一个数据库表来存储 cron 触发器和其他作业信息,然后“锁定”作业的条目,以便其他服务器都无法执行它。这可以防止作业在服务器上多次运行,并且到目前为止相当有效。

希望有帮助。

I guess I'm a little late responding to this, but we have a similar sort of scenario with our application. We have 4 servers running jobs, some of which can run on multiple servers concurrently, and some should only be run once. As Will's response said, you can look into the clustering features of Quartz.

Our approach was a bit different, as we had a home-grown solution in place before we switched to Quartz. Our jobs utilize a database table that store the cron triggers and other job information, and then "lock" the entry for a job so that none of the other servers can execute it. This keeps jobs from running multiple-times on the servers, and has been fairly effective so far.

Hope that helps.

浪漫之都 2024-09-02 22:16:12

我之前也遇到过同样的问题,但我发现我在作业运行时调用 scheduler.scheduleJob(job, trigger); 来更新作业数据,每次随机触发作业 5-6 次跑步。我必须使用以下内容来更新作业数据而不更新触发器 scheduler.addJob(job, true);

I had the same issue before but I discovered that I was calling scheduler.scheduleJob(job, trigger); to update the job data while the job is running which is randomly triggered the job 5-6 times each run. I had to use the following to update the job data without updating the trigger scheduler.addJob(job, true);

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