Management of Bean Instance Lifecycle
To effectively utilize system resources, EJB servers manage the lifecycle
of the bean instances contained in the container.
- The EJB spec defines how the container has to manage the
lifecycle of each kind of enterprise beans.
- The interfaces through which the container notifies a bean
about significant events in it's lifecycle are also defined.
The bean thus may receive
- notification before passivation (deactivation) of the bean
- notification after reactivation of the bean
- request to store/reload the bean's internal state
- notification before removal of the bean instance
Note: the actual instant of creation, passivation and activation of
bean instances are dependent on container internal resource
management policy. However, bean instance lifecycle management is
completely hidden from the client. If the bean instance was passivated
when the client invokes a request to the bean, it is activated automatically.
For stateless session bean, a pool of equivalent instance exists
and the container may assign arbitrary instance to process the client
request.
|