users@glassfish.java.net

Re: How to initialize EJB Timers cleanly in a cluster ?

From: <glassfish_at_javadesktop.org>
Date: Fri, 20 Feb 2009 10:04:26 PST

I tried to use the following piece of code to determine if my timer is already running:

String name = this.getClass().getName();
Collection<?> timers = timerService.getTimers();
for(Object t : timers)
{
        if(t instanceof Timer)
                continue;
        if(((Timer)t).getInfo().equals(name))
                return true;
}

But this checks only the timers of the _current bean instance_.

No chance to find timers on other hosts in the cluster...

This really sucks.
[Message sent by forum member 'batzee' (batzee)]

http://forums.java.net/jive/thread.jspa?messageID=333168