Win a copy of AWS Security this week in the Cloud/Virtualization 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Question related to ejbPassivate() Requirements

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

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.
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:
4. a bean's local component or home interface, EVEN IF it's not Serializable.

So your OrderBean will not be destroied while passivated.
I knew that guy would be trouble! Thanks tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic