First page Back Continue Last page Graphics

Passivation / Activation


Notes:

As an EJB server operates it will create dozens, even hundreds, of enterprise beans. At any given moment, most of those beans may be idle. To conserve memory, the container can passivate (deactivate) an idle bean. When a client needs that bean again, the container can activate it.
Both the SessionBean and EntityBean interfaces have two methods to react to these container actions: ejbPassivate( ) is called just before passivation, and ejbActivate( ), just after activation.
How the container actually passivates a bean instance depends on the type of bean. Stateless session beans are never passivated; they’re always ready in the pool. The container passivates stateful session beans by serializing them to disk and allowing them to be garbage collected. And entity beans are simply removed from use and put back into the ready pool.