A client may remove a stateful session bean by invoking a method of its business interface designated as a Remove method.
The lifecycle of a stateless session bean does not require that it be removed by the client. Removal of a stateless session bean instance is performed by the container, transparently to the client.
"The lifecycle of a stateless session bean does not require that it be removed by the client." I cannot understand this sentence, I suppose it want to tell stateless session bean can or cannot be removed by the client. However, it looks like the most important word "can" or "cannot" is lost.
What would be the purpose of removing stateless session bean by client? These beans aren't connected to clients between method calls. They are... well stateless. Immediately after being used by client SLSB is returned to pool of SLSB's and the rest is up to container.
In one word , NO Stateless sessions beans are sent back to the bean pool between method calls as they are not tied to any pone client every time a client calls a method on a SLSB the container randomly selects one from the bean pool and associates it with a client passing its reference to the client . Hence as SLSB are are only removed from the pool when the server/container sees it fit to do so , which is when its low on resources or depending on the timeout setting of the server specific xml discriptor file (basically it is server specific) , and never by the client on calling remove or any other method . It may also be removed if during a method call an exception occours from which the bean is not able to recover.
Only the Container can remove the Stateless Session Bean.
The following are the cases where the Stateless Session Bean will be destroyed.
1. If the Container finds that thee are already more beans in the pool, then there is possibility that few beans will be removed. If there is any @PreDestroy method, it will be called first and then destroyed
2. If Container crashes, then beans will be removed without calling @PreDestroy method [ December 12, 2008: Message edited by: LakshmiNarayana Kodali ]