Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

instance variables and passivation..

 
Kaarthik Sivashanmugam
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.
 
Jef Cumps
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.
 
Suman Sarker
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