Hello,
It looks like persistent timers are duplicated between reboots of jboss and undeployments of projects. The following is the use case, attached is a sample application to reproduce the problem. The project contains a singleton that also has @Startup annotation and contains a method that has a @Schedule annotation. By default the timer is persistent. Now
- start jboss
- deploy the application
- stop jboss
- remove the applicaiton from the deploy folder
- start jboss
- deploy the application
The log file shows that a persistent timer is executed multiple times. As example I also included a nonpersistent timer to the project.
2011-05-13 13:25:45,006 INFO [STDOUT] (pool-12-thread-5) persistent: timeOut from timer @Fri May 13 13:25:45 CEST 2011 and call speak():Hello world!
2011-05-13 13:25:45,012 INFO [STDOUT] (pool-13-thread-3) nonPersistent: timeOut from timer @Fri May 13 13:25:45 CEST 2011 and call speak():Hello world!
2011-05-13 13:25:45,015 INFO [STDOUT] (pool-12-thread-10) persistent: timeOut from timer @Fri May 13 13:25:45 CEST 2011 and call speak():Hello world!
2011-05-13 13:25:45,019 INFO [STDOUT] (pool-12-thread-2) persistent: timeOut from timer @Fri May 13 13:25:45 CEST 2011 and call speak():Hello world!
Is this a bug? It can be solved by setting persistent=false, so that is what I did for now. Is it okay to use @Startup and @Schedule(persistent=true) in the same bean?
Regards,
Chris