First page Back Continue Last page Graphics
Session Beans...
Removing a stateful session bean:
- Session ends, bean instance is destroyed
- Triggered when client calls EJBObject#remove( ):
Removing a stateless session bean:
- Bean instance is removed from pool, destroyed
- Container does this to shrink pool
- Client never trigger’s bean’s removal
Note:
- Client can call remove( ) on a stateless session bean
- This severs connection but does not destroy the bean
Notes:
Stateful session beans are removed by the client. The client does so by calling the remove( ) method of the EJBObject interface.
Session beans can be “removed”. For stateless session beans, removal occurs when the container decides to release the instance in order to shrink the pool. It is never called in response to client action. Clients do not remove stateless session beans.
Note that a client can (and often will) call that same remove( ) method against a stateless session bean. This is how the client severs the connection and ends the session. However, it does not “remove” the bean in the sense of destroying the bean instance. Only the container can do that, and it does so only when it wants to shrink the pool.