9 Replies Latest reply on Nov 26, 2012 6:02 AM by fcorneli

    @Schedule on JBoss AS 7.1.3.Final

    fcorneli

      I'm experiencing weird behaviour with @Schedule on JBoss AS 7.1.3.Final.

       

      I have a session bean with a method annotated with @Schedule(minute = "*", hour = "*"). This is supposed to fire every minute. Within this method I'm executing some JPA queries (to cleanup unused entities).

      When I restart JBoss AS 7.1.3.Final the timer sometimes fires constantly instead of every minute. Manually redeploying the application restores the timer to fire every minute.

      Somebody else experiencing this?

        • 1. Re: @Schedule on JBoss AS 7.1.3.Final
          nickarls

          Have you tried with persistent=false on the annotation? It might be the AS catching up or something.

          • 2. Re: @Schedule on JBoss AS 7.1.3.Final
            fcorneli

            It's indeed due to JBoss AS catching up. Funny thing is that even with persistent=false, the JBoss AS is doing the catching up thingy.

            Actually catching up with all previously missed schedule firings doesn't make sense. OK that you catch up by firing one invocation, but not all x lost ones.

            • 3. Re: @Schedule on JBoss AS 7.1.3.Final
              wdfink

              Hi Frank,

               

              for @Schedule it is the expected behavior that persistent=true catching up all missed events after a downtime. If this is not wanted use persistent=false.

              If you deploy the app with the changed annotation you might remove the stored timer in the data directory as the timer might be found here.

               

              If this will not work as expected could you check 7.2 upstream AFAIR with 7.1.2 this will work.

              • 4. Re: @Schedule on JBoss AS 7.1.3.Final
                fcorneli

                Indeed, once you have a @Schedule that has been marked persistent, it remains that way, even if you change the annotation. Bug?

                • 5. Re: @Schedule on JBoss AS 7.1.3.Final
                  nickarls

                  Perhaps it would be more natural if an undeploy/redploy of the application would also remove the associated timer. Or if the persistent timer would notice the deployment is no longer around, it would remove itself.

                  • 6. Re: @Schedule on JBoss AS 7.1.3.Final
                    wdfink

                    Yes Frank this will be a Bug. I raise AS7-5974 for this.

                    The timer is removed if you change the schedule together with the 'perstisten' flag but not if you only change the flag.

                    • 7. Re: @Schedule on JBoss AS 7.1.3.Final
                      wdfink

                      Nicklas Karlsson schrieb:

                       

                      Perhaps it would be more natural if an undeploy/redploy of the application would also remove the associated timer. Or if the persistent timer would notice the deployment is no longer around, it would remove itself.

                      I did not found a helpful statement in the EJB spec regarding the behavior.

                      From my point of view the undeploy should remove the related timers, maybe except if the admin add a flag or option.

                      A redeployment should only check the timers and remove it if there is no longer a timer instance for it.

                       

                      @Nicklas you should file a request for this.

                      • 8. Re: @Schedule on JBoss AS 7.1.3.Final
                        wdfink

                        I've fixed AS7-5974, it will be available in next 7.1 and 7.2 branches and the next release.

                        • 9. Re: @Schedule on JBoss AS 7.1.3.Final
                          fcorneli

                          Thanks for the fix.