• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Variable in Passivation

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am confused with the transient variable or non-transient(e.g. serializable object) variable different after passivation. Transient variable value will lose but non-transient variable value will be kept in activation?


Is it true we don't need to do anything (in ejbPassivated() method)? If it is wrong, what should we do in ejbPassivated() and ejbActivate() for those transient and non-transient varialbes.

Thanks!!!
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If an instance variable is NOT serializable, assign null in ejbPassivate() and re-initialize it back in ejbActivate().
If an instance variable is Serializable, you need not do anything in ejbPassivate() and ejbActivate(). The container guarantees proper restoration on activation.

Transient variables are generally considered sensitive and are not preferred to be written to secondary storage. The container ignores them during passivation. They may not be restored back also, even if they are Serializable. So what does a transient variable contain after ejbActivate() is run? It may be null or may even be a garbage!
[ March 02, 2005: Message edited by: Keerthi P ]
reply
    Bookmark Topic Watch Topic
  • New Topic