• 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 ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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.

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 ]
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic