Search code examples
jakarta-eetimerejbschedulingstateless-session-bean

Can I be sure that a SLSB which created a Timer will be handling its timeout (Java EE 5)?


In Java EE 5, when using timers and the timer service, who handles the timeout invocation?
Can I be sure that the stateless session bean which created the timer wil be the one to handle its timeout (with a @Timeout annoateted method)? or there's no way of telling which bean (of the same type) will handle it?

Also, Is there any difference on that issue between Java EE 5 and 6?


Solution

  • Can I be sure that the stateless session bean which created the timer will be the one to handle its timeout (with a @Timeout annotated method)?

    No, there's no guarantee. To provide such, an SLSB would have to be "reserved" somehow (doing nothing) to make sure it's available when the timeout elapses, which would make it, well, stateful. It's likely that for this very reason, timers cannot be used in stateful beans.