Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help me understand ejbPassivate, ejbRemove in Stateful Session  RSS feed

 
JPraveen Kumar
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • 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.
 
Balazs Borbely
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
swathi dave
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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)..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!