This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Stateful session bean passivation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Stateful session bean passivation" Watch "Stateful session bean passivation" New topic
Author

Stateful session bean passivation

Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
EJB 3.0 Core Specification:A container may only passivate a stateful session bean instance when the instance is not in a transaction.
I was thinking how and when such a scenario come up. After thinking for a while the following struck me.

a) Client starts a transaction using UserTransaction JNDI lookup.
b) Client invokes business methods on the session bean via session beans business interface.

Client remains idle long enough so that container can decide to passivate the sesion bean instance servicing the client.But before transfering the converstaional state to secondary storage, container realizes that this instance is in the middle of a transaction and hence will not passivate the instance.
****************************************
---------------
Environment
---------------
EJB Version : 3.0
Application Server: JBOSS 4.2.3.GA
J2SE: 1.5 or 5.0
OS: Windows XP
****************************************

a) Is my understanding correct? Are there any other scenarios ?
b) The container came to knew that the instance is middle of the transaction because the client requested the transaction from the transaction service provided by the container. Is this correct?
c) Why does not the container passivate the instance if its in the middle of a transaction. What is the problem?


SCJP, SCWCD, SCBCD
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
Experts, Please take time and reply.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stateful session bean passivation