This content has been marked as final. Show 3 replies
After succesfully starting the timer I shutdown the server. After restarting, the timer entriy is no longer in the database.
I'm trying to do the same thing. I can see the entry in the db when the timer is created, but when I shut down JBoss and look in the db again, the entry for the timer is gone. It looks like the table is getting wiped out when the server shuts down.
Is there a way to change this behavior? So far I like everything about the Timer implementation except this, and it's a pretty big show stopper. It's hard to depend on a timer service that can't even survive a server shut down.
I posted the same question a few days ago, it seems persistence is to be supported in the next major release.
I'm getting around the problem with a scheduler service. This goes to the jboss-service.xml file
<mbean code="org.jboss.varia.scheduler.Scheduler" name="jboss:custom=Scheduler"> <attribute name="StartAtStartup">true</attribute> <attribute name="SchedulableMBean">jboss:custom=MyBean</attribute> <attribute name="SchedulableMBeanMethod">process()</attribute> <attribute name="InitialStartDate">NOW</attribute> <attribute name="SchedulePeriod">60000</attribute> <attribute name="InitialRepetitions">-1</attribute> </mbean>
and process() is run every minute on MyBean
I believe this can be configured to run methods on a simple POJO etc. but haven't tried. Let me know if you need more details and I will post a couple of links.