2 Replies Latest reply on Sep 29, 2012 2:00 PM by haukegulich

    Timer catching up after jboss stopped

    haukegulich

      Hello everyone,

       

      I read in some other posts that this behavior is correct and is expected like that.

      I annotated a methode with

       

      @Schedule (hour = "*", minute="0,10,20,30,40,50")

       

      and the method will be executed every 10 minutes. In my case this method writes some weather data into my database.

      Now I stopped the application server for 5 days and after restarting, he inserted the same data over and over again.

       

      I also read that I can not deactived this behavoir but that post is already one year old.

       

      Is there a way to deactivate this function or is there a work-a-round?

       

       

      Thanks,

      Hauke

        • 1. Re: Timer catching up after jboss stopped
          wdfink

          The behaviour depends on the persistence of the timer.

          If you have a scheduler which is persistent (that is your case) all events are fetched later if the server is down for that event(s).

          If you mark the scheduler as non-persistent the event is only fired if the server is active and this it what you want.

           

          So add the attribute 'persistent = false' to your annotation.

           

          Also you can simplify and use minute="*/10" which mean the same as yours => every 10minutes

          • 2. Re: Timer catching up after jboss stopped
            haukegulich

            Thanks for the information. Works perfectly :-)

             

            greetings,

            Hauke