• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Using both @StatefulTimeout and @TransactionAttribute's Never

 
Ranch Hand
Posts: 1738
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
In Ivan's notes, p.22,


On p.26, it says


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.
 
Himai Minh
Ranch Hand
Posts: 1738
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!