3 Replies Latest reply on Oct 19, 2007 7:09 AM by axismundi

    ejbTimeout called when Timer.cancel is called

    hanseno2

      We are running JBoss 4.0.0 with TimerService
      When timer.cancel is called, ejbTimeout is instantly called.
      Calling timer.cancel in ejbTimeout throws javax.ejb.NoSuchObjectLocalException: Timer was canceled

      I thought ejbTimeout should not be called if Timer is cancelled.

      Also I am havin trouble with IllegalStateException when cancelling timer-how do I check what state a timer is in?

      Any feedback is greatly experienced!

      Sincerely

      Espen Albrektsen

        • 1. Re: ejbTimeout called when Timer.cancel is called
          hanseno2

          ejbTimeout was not called after Timer.cancel - it was called because i created a new Timer with a timeout that allready was expired. (Method is used to handle configuration changes)

          I am still having problems cancelling timer - how can I securely cancel a Timer? (I can of course do

          try
          {timer.cancel();}
          catch (Exception e)
          { /* Do nothing */ }

          but this seems like a rather uglyu workaround...


          • 2. Re: ejbTimeout called when Timer.cancel is called
            icruz

            Hello,

            I have the same problem with JBoss 4.2.1GA. I have a @Service EJB, in start() method I create a EJB timer, and it works.

            The first problem is when I shutdown jboss, in the stop() method of the Service EJB I call the method timer.cancel(), and it throws an exception with the message "timer was canceled", but the timer remains in the database (if I call stop() from the JMX console, it is cancelled correctly)

            The second problem is when I restart jboss, in the start() method of my service EJB, the function timerService.getTimers() returns an empty collection (even the timer *is* in the database), and when I try to create the timer it fails with a "duplicate key" exception from MySQL driver

            Thanks in advance,
            Isaac

            • 3. Re: ejbTimeout called when Timer.cancel is called
              axismundi

               

              "icruz" wrote:
              Hello,

              ... and when I try to create the timer it fails with a "duplicate key" exception from MySQL driver

              Thanks in advance,
              Isaac


              I wonder where in the JMX-console could you cancel the timer??
              I was unable to find it.