Ask the Expert

What is object pooling?

What happens to EJB when it's in a pool? Do stateless EJBs live in a pool? What is object pooling?

    Requires Free Membership to View

"Object pooling" (sometimes called "resource pooling") is a term used to describe a mechanism for reusing temporary objects, thus, reducing the number of objects that are created, optimizing instantiation time and reducing garbage collection.

During the creation process of a stateless session bean, the EJB container invokes the setSessionContext() method of the SessionBean and then calls the ejbCreate() method. If a free instance of the SessionBean is found in the container's pool, the container reuses it. If no free instance is found, one is created and added to the container's pool of stateless session beans. Because stateless session beans do not maintain client-specific state, the container can use any free instance to handle an incoming method call. When the container removes a session bean from the session bean object pool, it calls the ejbRemove() method of the bean.

This was first published in January 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: