• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

transient + passivation

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic