• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

when passivation is called

 
james edwin
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

There is little debate going on between me and my friend ,like when Container call Passivate method.

I say " IT"S container algorithm....."after reading following lines from EJB SPEC 2.0 (Page no 78)

Quote
**************
The container’s caching algorithm may decide that the bean instance should be evicted from memory (this could be done at the end of each method, or by using an LRU policy). The container issues ejbPassivate on the instance
***************

But my friend says "Whenever container wants to increase the size of pool,it calls passivate method..he came to this conclusion after reading
below from EJB2.0(page no 70)

Quote
***************
To efficiently manage the size of its working set, a session bean container may need to temporarily
transfer the state of an idle stateful session bean instance to some form of secondary storage. The transfer
from the working set to secondary storage is called instance passivation. The transfer back is called
activation
****************

Can anyone put more light on this...

James
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no pool of stateful beans, they all take up memory and hang onto resources. Bear in mind that because a stateful bean is tied to a client, you can have a lot of them. Think of a busy web site with 10,000 users logged in, you need 10,000 stateful session beans. But only a fraction of these users will be doing anything that requires the use of a bean, so after a while (but before the bean times out) the container decides to passivate the idle bean by invoking ejbPassivate() to free up memory. This is only done if the bean is not in a transaction. Once passivated, the memory which was held by the bean can then be garbage collected.

The container�s caching algorithm is used to decide when to passivate, and some containers do give the Deployer the ability to influence when passivation should start after a period of inactivity.
 
james edwin
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roger Thanks for reply.

But question is not related to stateful session beans.we know they are not part of POOL.

It's related to other beans which take part in pool like entity beans,stateless session beans when Container will call ejbpassivate ()...it's container algorithm or something else. ?

Regards,

James
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic