• 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

Help me understand ejbPassivate, ejbRemove in Stateful Session

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wanted to knwo when the server calls ejbPassivate vs. ejbRemove.

Im referring to Heads first EJB
Page 201 : When the client doese not calll any methods for a while container calls ejbPassivate() on the bean.

Page 210 : Client doesent make any calls to the beans component interface for a longtime and the containter decides to kill the bean and calls ejbRemove().

Im not clear with the above statements.

If the session bean is active (not passivated) and the client is not calling any methods then is the session stateful bean passivated or removed?

Is this to be read as passivation timeout < ejbremove timeout.

Thanks Praveen.
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The container depending on his caching algorithm can call at any moment (except when the bean is in a transaction )the ejbPassivate.

After the lifetime of the EJB has expired (timeout) the ejbRemove will be called if the bean was in ready state; If it was already passivated than, is marked as deleted.
 
JPraveen Kumar
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im still not clear...

If the session bean is active (not passivated) and the client is not calling any methods then is the session stateful bean passivated or removed?

Pls explain Tx Praveen
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When ejbRemove() is called :
If it is a stateful bean in active state, ejbRemove() will be called when the bean times out ..
(note :if the container finds the bean in passivated mode, the container WILL NOT CALL ejbRemove(). In this case the bean will be sent straight to the Garbage Collector. )

When ejbPassivate() is called :
while the stateful session bean is in active state,the container may decide to passivate it (i.e call ejbPassivate())if there is need to manage the resources (provided no client is executing a call on that bean currently)..
 
Did you miss me? Did you miss this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic