This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds 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 ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

instance variables and passivation..  RSS feed

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did not understand the following passivation rule (page no 71 in specs). Could someone translate the following into simple English ?

An object that is not directly serializable, but becomes serializable by replacing the references to an enterprise bean�s home and component interfaces, the references to the SessionContext object, the references to the java:comp/env JNDI context and its subcontexts, and the references to the UserTransaction interface by serializable objects during the object�s serialization.

This means, for example, that the Bean Provider must close all JDBC� connections in ejbPassivate and assign the instance�s fields storing the connections to null.

The last bulleted item covers cases such as storing Collections of component interfaces in the conversational state.



Thanks in advance.
 
cowbird
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this is in the context of session bean passivation, what this paragraph is saying is:

The container uses a special set of rules to passivate session beans, it looks like serialization, but is not really the same. It's not as simple as making non-Serializable variables transient. The container must NOT assure that transient fields are braught back with default values.

When ejbPassivate() completes, you (as a Bean Provider) must make sure that all non-transient instance variables are one of the following:
* Serializable
* null
* Remote or Local Component or Home interface
* SessionCOntext object
* the JNDI context or one of its subcontexts
* UserTransaction interface
* resource manager connection factory (like a DataSource)

Hope this helps...
[ June 09, 2004: Message edited by: Jef Cumps ]
 
Kaarthik Sivashanmugam
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply, Jef. It did not answer my question though. What I have quoted in my posting is the last point in the passivation rules. This is mentioned in the specs in addition to what you have added in your posting. I wanted to understand what I have quoted from the specs.
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Karthik,
According to the EJB spec page 72,

The last bulleted item covers cases such as storing Collections of component interfaces in the conversational state.



So, in plain english, the last bulleted point can be described as the following

An object that is not directly serializable, for example, a Collection becomes serializable if it contains the references to ..
1. an enterprise bean�s home and component interfaces
2. the SessionContext object,
3. the java:comp/env JNDI context and its subcontexts
4. the UserTransaction interface

Hope this helps.

Regards
Suman
[ June 10, 2004: Message edited by: Suman Sarker ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!