• 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

Variable in Passivation

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
Trust God, but always tether your camel... to this tiny ad.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic