如何避免在高可靠性集群JBoss EAP中运行重复任务 [英] How to avoid running duplicate tasks in a High Avaliability Clustered JBoss EAP

查看:246
本文介绍了如何避免在高可靠性集群JBoss EAP中运行重复任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在开发需要有一些后台作业的应用程序,例如在待处理的警报上发送电子邮件。在独立配置中,作业使用Spring调度程序和调度任务进行配置和工作。
但是我不知道如何使它们在高可用性的JBoss环境下同步工作。主要问题是避免不同节点上的作业同时运行。

Im developing an application that needs to have some background jobs, for example for sending emails on pending alerts. In a standalone configuration the jobs are configured and working fine with Spring scheduler and scheduled-tasks. But i don't know how to make them work synchonized on a clustered with high avaliability JBoss environment. The main problem is to avoid that jobs on different nodes run at the same time.

我已经阅读了关于Quartz:

I've read this about Quartz:

http://quartz-scheduler.org/documentation/ quartz-2.x / configuration / ConfigJDBCJobStoreClustering

但是在高可用性情况下不建议使用它:

But it's not recomended on on a high avaliability scenario:


不要在不同的计算机上运行集群,除非他们的时钟是
同步使用某种形式的时间同步服务(守护进程)运行
非常在彼此的秒内)。请参阅
http://www.boulder.nist.gov/timefreq/

Never run clustering on separate machines, unless their clocks are synchronized using some form of time-sync service (daemon) that runs very regularly (the clocks must be within a second of each other). See http://www.boulder.nist.gov/timefreq/service/its.htm if you are unfamiliar with how to do this.

到现在为止,我们的服务/ its.htm解决了自制阻塞系统的同步问题(为什么我的悲观锁定在JPA与Oracle不工作)。但我想知道JBoss是否为这个常见的问题提供了一些解决方案。

By now i have workarounded the synchronization problem with a self made blocking system (Why my pessimistic Locking in JPA with Oracle is not working). But i wish to know if JBoss provides some solution for this certainly common problem.

推荐答案

您可以尝试一个HA Singleton一个EJB Singleton配置为仅在集群中的一个节点上运行。然后,该单例可以使用EJB Timer服务来调度作业。请参阅有关HA singleton的文档: https:// access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Development_Guide/Implement_an_HA_Singleton.html

You can try an HA Singleton, which is an EJB Singleton configured to be only running on one node in a cluster. That singleton can then use the EJB Timer Service for scheduling your jobs. See the documentation about HA singleton: https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Development_Guide/Implement_an_HA_Singleton.html

这篇关于如何避免在高可靠性集群JBoss EAP中运行重复任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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