Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

transient + passivation

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

my question is about passivation for stateful session beans.
Imagine you've got a reference to a variable that is not Serialisable, not a reference to component or home interface, not a reference to SessionContext, JNDI context, UserTransaction, or Resource Manager Factory.
The spec says you have to null out its value so that the passivation runs well. (and so reset the value after passivation in ejbActivate()).

What's the difference with declaring this variable simply as transient? You won't need to null out in ejbPassivate() but will still have to reset in ejbActivate() method.

Regards,
Cyril.
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cyril,

What's the difference with declaring this variable simply as transient? You won't need to null out in ejbPassivate() but will still have to reset in ejbActivate() method.



The Bean Provider must assume that the content of transient fields may be lost between the ejbPassivate and ejbActivate notifications. Therefore, the Bean Provider should not store in a transient field a reference to any of the following objects: SessionContext object; environment JNDI naming context and any its subcontexts; home and component interfaces; and the User-Transaction interface.

The restrictions on use of transient fields ensure that Containers can use Java Serialization during passivation and activation.

Hope that clears your thoughts!
 
what if we put solar panels on top of the semi truck trailer? That could power this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic