users@glassfish.java.net

Re: Non-persistent Singleton timers in a clustered environment using GF3.1

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Mon, 18 Jul 2011 16:36:34 -0700

May be there is something going on in your setup? An interceptor of any
kind? The timer behavior shouldn't change during the run. Non-persistent
timers are getting recreated after each restart (on each instance - vs.
persistent timers that will be executed only on 1 instance in a cluster).

-marina

Jacques wrote:
> I'm trying to use non-persistent timers to fire singleton actions (for
> refreshing local cache) in a clustered environment. The same code
> works fine if I run it in a non-clustered environment.
>
> I've tried both TimerService.createIntervalTimer and @Schedule
> annotation and neither seems to work correctly.
>
> When I monitor the ejb-timer-service-app I see that the timer gets
> created but then it disappears after the first expiration. I don't
> see any errors in the logs.
>
> //works fine, fires every third minute for one instance in cluster
> @Schedule(minute="*/3", hour="*", dayOfMonth="*", month="*", year="*")
> public void startWork(Timer t)
>
> // Never fired. Upon deploy, all nodes in cluster show an active
> non-persistent timer (via EJB timer web app). Timer disappears after
> what appears to be first expiration.
> @Schedule(minute="*/3", hour="*", dayOfMonth="*", month="*", year="*",
> persistent=false) public void startWork(Timer t)
>
>
> What is the expected functionality in a clustered singleton
> environment? As described above, I know that persistent timers work
> fine (and are constrained to a single instance across the cluster as
> expected).
>
> Which logger would give me more information about what is happening?
>
> Thanks,
> Jacques