• 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

activate and passivate methods

 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi how do these methods work
I understand the ejb container calls them directly
but isnt there some sort of code i have to put nto theses methods?
thanx
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When a container decides that a particular entity bean instance has been sitting around in the container long enough, without being called upon, it might decide to reclaim that memory and 'passivate' the bean.

So the container calls ejbPassivate. I have seen some examples where the id field of the bean is set to null. But it could also be left empty.

When a client calls upon a passivated bean, then the container must call ejbActivate. It is pretty important in this method to put code there that would 'reinitialize' the id field of the bean.
eg:
But I have also seen examples where both of these methods are left blank. So I'm not sure how 'critical' they are.
 
Fred Abbot
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you
 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mike Curwen:
But I have also seen examples where both of these methods are left blank. So I'm not sure how 'critical' they are.


The reason is ejbActivate() and ejbPassivate() takes some of the resources for activation and passivation.So probably, it is better to improve on the memory requirements instead on activating and passivating the resources.
Hope this helps,
Sandeep
 
reply
    Bookmark Topic Watch Topic
  • New Topic