0 Replies Latest reply on Apr 2, 2009 5:26 PM by Rajasekhar Devi Reddy

    EJB timer issue durning server restart

    Rajasekhar Devi Reddy Newbie

      Hi,

      I am using JBOSS 4.2.3 AS. The problem I am facing is, I have an EJB timer set to run at 6 am every day. The timer is created using create method of EJB which accepts a start date and time-out period. Which are set to 6 Am next day and 24 hrs respectively while creation.

      It runs fine normally, but if for some reason server is restarted or the applications EAR fiel is redeployed(hot deploy) say at 11 AM some day then the timer goes off right away and then the code starts running at 11AM there after instead of 6AM. Probably the server after it starts up, reads the start time in ejb timer (which obviously would be a time in the past as timer was started few days back when it was first created) and times out right away.

      To solve this I have provided functionality righ in the application's UI to cancle all and recreate all timers. while recreating timers I set the start time to a future date but the same hour of the day (6 AM next day). My assumption is every time some one changes code or performs a server restart they have to cancel all timers first, do their work and then click on 'create all'.

      I am not sure if I am doing it in an efficient way. I want to know if there is a way I can do this using some thing already built in JBOSS. Am I re-inventing the wheel?

      Thank you for your time...