[jboss-user] [JBoss Seam] - probelm with asynchronous methods and timers
frehan
do-not-reply at jboss.com
Wed May 9 10:05:23 EDT 2007
I have a usecase where I want to have a recurring service checking some db information and send out mails i nessesary. I started with a simple scheduled service that worked fine. Then I wanted to use Seam to send out my mails but I got problems with failed rendering because I was outside of the seam context in my scheduled service bean. So I switch to using seam asynchronous methods and timers.
I have a bootstrap action annotated with
@Startup(depends={"org.jboss.core.jndi", "org.jboss.core.jta"})
and then a @Create annotated method to start the asynchronous action with a timer.
The boostrap action is application scoped and stores the timer instance for the duration of the application lifecycle. The timer is destroyed in the @destroy method. When the timer is created it is stored by the application server in the timer db table and removed when the server is stoped or my application undeployed.
Now to the problem :-)
Sometimes the timer is not removed from the db when the server is stopped. Then when I start the server again a new timer is created in my bootstrap action and now I have to timers running making my service run more often then I want.
How can I avoid this problem? Is this the wrong solution for my usecase or can I somehow check for exising timers when bootstrapinig or can I shedule my asynchronous methos in the same way that i schedule my service in a xml file or ... ?
Thankfull for all input!
Best regards Fredrik
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044301#4044301
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044301
More information about the jboss-user
mailing list