问题
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...
回答1:
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.
来源:https://stackoverflow.com/questions/6948360/ejb-3-0-timer-cluster-info