禁用 EJB 计时器(GlassFish 3.1、Java EE 6)
我们有一个 VIP (BIG-IP),它实际上将 Web 服务请求移动到两个节点,每个节点都有自己的 GlassFish 服务器 3.1 并部署了我们的服务。所以它不是真正的玻璃鱼群。 我的问题是,我有很多调度程序服务,如下面列出的服务:
@Schedule(minute = "55", hour = "23", dayOfWeek = "Wed")
public void runScheduledMedicaidPaymentProcess() {
有没有一种方法可以让我在一个节点上禁用 EJB 计时器服务,以便当晚上 11:55 时上述方法不会在两个节点上运行周三?
我确实看到 Glassfish 服务器文档中提到了集群的 _Default 池的使用,但正如我之前所解释的,我们的集群不是真正的集群。请告诉我是否有任何方法可以停止计时器,使其不被激活。
We have a VIP (BIG-IP) that actually moves the web service requests to two nodes each with its own GlassFish server 3.1 and our services deployed. So it is not a true glassfish cluster.
My problem is that I have a lot of Scheduler services like the one listed below:
@Schedule(minute = "55", hour = "23", dayOfWeek = "Wed")
public void runScheduledMedicaidPaymentProcess() {
Is there a way for me to disable the EJB Timer Service on one node so that the above method is not run on both nodes when it is 11:55 pm on Wednesday?
I did see the use of _Default pool for Clusters mentioned in Glassfish server document, but as I explained before ours is not a true cluster. Please let me know if there is any way to stop the timer on one so that it is not activated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您不使用集群,那么您实际上只有两个独立的实例。您将必须创建某种信号量以供每个方法检查(数据库列可能是一个很好的解决方案)。该方法将返回是否可以运行计时器。您的每个实例都会调用该方法,但只有一个实例最终会运行计时器。
或者...
设置一个集群。
If you're not using a cluster then you really just have two independent instances. You're going to have to create some sort of semaphore that each method checks (a db column might be a good solution). The method would return whether or not it's okay to run the timer. Each of your instances would call the method but only one instance would end up running the timer.
Or...
Setup a cluster.