1 Reply Latest reply on Aug 23, 2005 6:07 PM by depl20982

    Timer warning

    adamw

      Hello,
      I have a timer service started, and every time it timeouts a new timer is scheduled I get this warning:

      22:09:34,302 WARN [TimerImpl] Timer was not registered with Tx, reseting state: [id=3target=[target=jboss.j2ee:service=EJB3,name=org.jboss.forge.service.ForgeTimer],remaining=-6872,periode=0,in_timeout]

      Which is true, as the timer is not registered with a transaction. However, can I get rid of this warning?

        • 1. Re: Timer warning
          depl20982

          Hi.

          I was having the same problem with scheduled timers, I made a workaround for this behaviour; but I still need to know the cause of the warning.

          The code to reproduce the WARN is:



          public void startTimer() {
          ctx.getTimerService().createTimer(0, 1000, "Hello World");
          }

          @Timeout
          public void timeoutHandler(Timer timer)
          {
          System.out.println("* Received Timer event: " + timer.getInfo());
          }


          The workaround is:


          public void startTimer() {
          ctx.getTimerService().createTimer(0, "Hello World");
          }

          @Timeout
          public void timeoutHandler(Timer timer)
          {
          System.out.println("* Received Timer event: " + timer.getInfo());

          //Recreate the timer to avoid WARN
          timer.cancel();
          ctx.getTimerService().createTimer(1000, "Creating EJBs");
          }


          The fact is that I need to recreate the timer every time to avoid the WARN.

          Is there one elegant solution to avoid the WARN?