• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question related to ejbPassivate() Requirements

 
Sandesh Tathare
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Say in ejbPassivate() method of a Session Bean OrderBean, I have reference to another session bean�s local home interface as an instance field, and it is not Serializable, would this cause Container to destroy OrderBean instance as instance does not meet requirements for Serialization after ejbPassivate?

NOTE: I know it's not a common case of Session Bean storing reference of another Session Bean's Home interface. Generally Session Beans interact with Entity Beans. But let's say for application requirements, we have such a scenario.


Please refer to section 7.4.1 Instance passivation and conversational state

The objects that are assigned to the instance�s non-transient
fields after the ejbPassivate method completes must be one of the following:
� An entity bean�s local interface reference, even if it is not serializable.
� An entity bean�s local home interface reference, even if it is not
serializable.
 
Arun Krishnamoorthy
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My guess is that this would be dependent on the container implementation...the EJB spec does not illustrate how a Container should manage its pool. All required optimizations are left upto the vendor's choice. A smart container may remove the referenced bean instance during passivation but, I am not familiar if any commercial products actually do it.
 
X. Li
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please see P.203 of HF EJB: "When ejbPassivate() completes,every non-transisent instance variable MUST be a reference to one of the following:
1.
2.
3.
4. a bean's local component or home interface, EVEN IF it's not Serializable.
....."

So your OrderBean will not be destroied while passivated.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic