posted 23 years ago
About Stateless session beans:
Because Stateless session bean's ejbCreate() method takes in no parameters,clients never supply any critical information that the bean instances need to startup. The EJB Containers can thus precreate instances of your stateless session beans.When a client calls a method, the container can retrive a instance from the pool, have it service a method, and then return it to the pool
Stateless sessions hold conversations spanning a single method request and are free of client specific state after each method call.All stateless session beans think that they are in the same state after a method call; they are unaware that previous method calls happened. Therefore the container can dynamically reassign beans to the client requests at the per-method call.
About Stateful Session Beans.
When the client invokes a method on a bean, the client is starting a conversation with the bean, and the conversational state stored in the bean must be available for the same clients next method request.To limit the number of stateful session bean instances, the container can swap out a stateful bean saving its conversational state to a hard disk or other storage. This is called passivation. When the original client invokes a method, the passivated conversational state is swapped in to a bean. This is known as activation. The bean can thus resume conversation with the original client.
The container, in case of stateful session beans, may use any algorithm like LRU or whatever to deciede which stateful bean has to be passivated . The algo used varies from container to container.
NOTE: the only time a stateful session bean cannot be passivated is .. if it is involved in some sort of transaction..
so bottom line is that both stateful and stateless session beans can be pooled and the details are as above..and also the conditions ...
i hope this helps
regards
Dharmesh Chheda
[ March 06, 2002: Message edited by: Dharmesh Chheda ]
regards,<br />Dharmesh Chheda