The session bean implementation class is annotated with the @StatefulTimeout annotation. This annotation is used to tell the container the idle time after which an instance of the stateful session bean will be eligible for removal.
On p.27, it says
The session bean implementation class is annotated with the @TransactionAttribute(TransactionAttributeType.NEVER annotation. This is to ensure that instances of the EJB is never in the method ready in transaction state, in which case they will never timeout and become eligible for removal (as described above).
Do the above two quotes conflict with each other?
The stateful bean is eligible for removal after 10 seconds of being idle (timeout) as it is said on p.26.
The bean is never in a transaction, in which case the bean will never timeout and never become eligible for removal.
If anyone knows what these two quotes mean, please let me know. Thanks.
posted 5 years ago
I think I may be able to answer my question.
On p. 34 of the notes, there is a state diagram with "method ready in transaction".
According to the code on p.22, the stateful session bean is never in this state.
Even if the bean is in this method ready in transaction, timeout will never happen within this state.
Timeout only happens when the stateful bean is in passivate state or method ready state. When timeout happens, the bean will be in non-exist state (being removed).