This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of TensorFlow 2.0 in Action and have Thushan Ganegedara on-line!
See this thread for details.
Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Using both @StatefulTimeout and @TransactionAttribute's Never

 
Bartender
Posts: 1956
13
  • 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
Bartender
Posts: 1956
13
  • 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).
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic