0 Replies Latest reply on May 21, 2009 2:11 PM by Joshua Tharp

    Timer cancled during timeout execution

    Joshua Tharp Newbie

      I'm using an EJB3 style Stateless Session Bean as a target for a timer. During my integration testing I have the timer turned up to repeat very quickly (100ms interval) so that I don't have to wait for too long while the tests are executing. However, it has illustrated a problem that may have taken a really long time to witness (in fact I may never have witnessed it).

      My test configures the timer to run on a tight interval, calls a method that starts the timer, does some checking to make sure the timer has done its job, and then cancels the timer. However, the test frequently cancels the timer while the handleTimeout method is executing. I know this, because I check to see if the Timer is valid at the beginning of the method, but toward the end of the method I get an exception when I call Timer.getInfo

      10:56:12,890 ERROR [TimerImpl] Error invoking ejbTimeout ejb.NoSuchObjectLocalException: Timer was canceled

      Being in a session bean, I had assumed that the public methods, including the @Timeout public void handleTimeout(Timer tmr) method would be transactional and therefore wouldn't interfere with each other like this.

      Am I doing something wrong or is there a bug here?