Top Description Interfaces Classes Enums
[default module]

Package org.apache.commons.pool2


Object pooling API.

The org.apache.commons.pool2 package defines a simple interface for a pool of object instances, and a handful of base classes that may be useful when creating pool implementations.

The pool package itself doesn't define a specific object pooling implementation, but rather a contract that implementations may support in order to be fully interchangeable.

The pool package separates the way in which instances are pooled from the way in which they are created, resulting in a pair of interfaces:

ObjectPool
defines a simple object pooling interface, with methods for borrowing instances from and returning them to the pool.
PooledObjectFactory
defines lifecycle methods for object instances contained within a pool. By associating a factory with a pool, the pool can create new object instances as needed.

The pool package also provides a keyed pool interface, which pools instances of multiple types, accessed according to an arbitrary key. See KeyedObjectPool and KeyedPooledObjectFactory.

Interface Summary

Modifier and TypeInterface and Description
public interface
KeyedObjectPool<
The type of keys maintained by this pool.
K
,
Type of element pooled in this pool.
V
>

A "keyed" pooling interface.

public interface
KeyedPooledObjectFactory<
The type of keys managed by this factory.
K
,
Type of element managed by this factory.
V
>

An interface defining life-cycle methods for instances to be served by a KeyedObjectPool.

public interface
ObjectPool<
Type of element pooled in this pool.
T
>

A pooling simple interface.

public interface
PooledObject<
the type of object in the pool.
T
>

Defines the wrapper that is used to track the additional information, such as state, for the pooled objects.

public interface
PooledObjectFactory<
Type of element managed in this factory.
T
>

An interface defining life-cycle methods for instances to be served by an ObjectPool.

public interface
SwallowedExceptionListener

Pools that unavoidably swallow exceptions may be configured with an instance of this listener so the user may receive notification of when this happens.

public interface
TrackedUse

Allows pooled objects to make information available about when and how they were used available to the object pool.

public interface
UsageTracking<
The type of object provided by the pool.
T
>

This interface may be implemented by an object pool to enable clients (primarily those clients that wrap pools to provide pools with extended features) to provide additional information to the pool relating to object using allowing more informed decisions and reporting to be made regarding abandoned objects.

Class Summary

Modifier and TypeClass and Description
public abstract class
BaseKeyedPooledObjectFactory<
The type of keys managed by this factory.
K
,
Type of element managed by this factory.
V
>

A base implementation of KeyedPooledObjectFactory.

public abstract class
BaseObject

A base class for common functionality.

public abstract class
BaseObjectPool<
Type of element pooled in this pool.
T
>

A simple base implementation of ObjectPool.

public abstract class
BasePooledObjectFactory<
Type of element managed in this factory.
T
>

A base implementation of PoolableObjectFactory.

public class
PoolUtils

This class consists exclusively of static methods that operate on or return ObjectPool or KeyedObjectPool related interfaces.

Enum Summary

Modifier and TypeEnum and Description
public enum
DestroyMode

Destroy context provided to object factories via destroyObject and invalidateObject methods.

public enum
PooledObjectState

Provides all possible states of a PooledObject.