本文介绍了EJB 3.0定时器集群信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够在EJB3.0 Timer Service上得到一些手段。我能够获得超时时间,我可以使用servlet Context listener调用定时器。我已经部署了一个简单的应用程序,它以特定的方式发送警报interval.I使用WL 10.3.1(不支持EJB3.1,使用Scheduler)。
我同时收到两次警报(我有一个带有2个受管服务器的群集)。我查看了在WL群集中使用定时器的例子,例如:。但是我想避免在服务器上进行任何配置。有什么其他方法可以在Cluster Env.I中进行控制想要在一个群集Env中随时有一个计时器。



谢谢...

解决方案

在contextInitialized期间,servlet上下文监听器是否无条件地创建定时器?如果是这样,这解释了问题,因为servlet上下文监听器将在每个JVM中运行。您需要以某种方式检查计时器是否已经先创建。使用getTimers或者检查/插入一行到您自己的数据库表中。


I was able to get some hands on EJB3.0 Timer Service.I was able to get the timeout working and I was able to invoke the timer using servlet Context listener.I have deployed a simple app which sends alerts at a specific interval.I am using WL 10.3.1(does not support EJB3.1,to use Scheduler).I get alerts twice at the same time.(I have a cluster with 2 managed Servers).I looked at few examples of using a timer in WL cluster,for eg: http://shaoxiongyang.blogspot.com/2010/10/how-to-use-ejb-3-timer-in-weblogic-10.html .But I would like to avoid any configuration on the server.Is there any other way this can be controlled in a Cluster Env.I want to have one timer running at any time in a cluster Env.

Thanks...

解决方案

Do the servlet context listeners unconditionally create the timer during contextInitialized? If so, that explains the problem since the servlet context listener will run in each JVM. You'll need to somehow check if the timer has already been created first. Either use getTimers or check/insert a row into your own database table.

这篇关于EJB 3.0定时器集群信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 08:13