Instance pooling

How it works

Instance pooling allows EJB Server to maintain a cache of component instances and bind them to client sessions on an as-needed basis. When components support instance pooling, the scalability of your application increases. Instance pooling eliminates execution time and memory consumption that would otherwise be spent allocating unnecessary component instances.

Implicit pooling of EJB components

Entity Beans and stateless session Beans can be implicitly pooled after any method invocation. EJB Server calls the activate and passivate methods to indicate when an instance has been bound to a client session.

Stateful session Beans remain bound to a client session as long the server has not crashed, the client has not called remove to unbind from the instance, or the Beans session timeout value has not expired. EJB Server may serialize the instance and save it to disk to conserve memory. EJB Server calls the passivate method before serializing the Bean, and the activate method when the Bean has been deserialized. In the code for these methods, you must release and reacquire any object references that do not support serialization.