|
|
|
| |
Passivation
Activation is a process of transferring
an enterprise bean from memory to secondary
storage.
Passivation is the act of disassociating a stateful
bean instance from its EJB object and saving
its state. Passivation requires that the bean
instance’s state be held relative to its EJB
object. After the bean has been passivated,
it is safe to remove the bean instance from
the EJB object and evict it from memory. Clients
are completely unaware of the deactivation process.
Calling of ejbPassivate () for passivation is
a warning to the bean that its held conversational
state is about to be swapped out. It is important
that the container inform the bean using ejbPassivate
() so that the bean can relinquish held resources.
The EJB container calls the ejbPassivate ()
method to give the bean a chance to release
the resources or deal with the resources as
the bean see fit.
The
activation process is supported by the state
management call methods ejbActivate () and ejbPassivate
() methods which notify the stateful session
bean that it is about to be activated or passivated
respectively. The ejbPassivate () method is
called immediately prior to the passivation
of the bean instance.
Entity
beans do not have conversational state that
needs to be serialized like stateful beans;
instead the state of entity bean instance is
persisted directly to the data base. Entity
beans do, however, leverage the activation callback
methods ejbActivate () and ejbPassivate () to
notify the instance when it is about to be swapped
in or out of the instance pool. The ejbActivate
() method is invoked immediately after the bean
instance is swapped into the EJB object and
the ejbPassivate () method is invoked just before
the instance is swapped out of the instance
pool.
|
|