| java.lang.Object org.apache.commons.pool.PoolUtils
PoolUtils | final public class PoolUtils (Code) | | This class consists exclusively of static methods that operate on or return keyedPool related interfaces.
author: Sandy McArthur version: $Revision: 385296 $ $Date: 2006-03-12 10:28:08 -0500 (Sun, 12 Mar 2006) $ since: Pool 1.3 |
Constructor Summary | |
public | PoolUtils() PoolUtils instances should NOT be constructed in standard programming. |
Method Summary | |
public static PoolableObjectFactory | adapt(KeyedPoolableObjectFactory keyedFactory) Adapt a KeyedPoolableObjectFactory instance to work where a PoolableObjectFactory is
needed. | public static PoolableObjectFactory | adapt(KeyedPoolableObjectFactory keyedFactory, Object key) Adapt a KeyedPoolableObjectFactory instance to work where a PoolableObjectFactory is
needed using the specified key when delegating.
Parameters: keyedFactory - the KeyedPoolableObjectFactory to delegate to. Parameters: key - the key to use when delegating. | public static KeyedPoolableObjectFactory | adapt(PoolableObjectFactory factory) Adapt a PoolableObjectFactory instance to work where a KeyedPoolableObjectFactory is
needed. | public static ObjectPool | adapt(KeyedObjectPool keyedPool) Adapt a KeyedObjectPool instance to work where an ObjectPool is needed. | public static ObjectPool | adapt(KeyedObjectPool keyedPool, Object key) Adapt a KeyedObjectPool instance to work where an ObjectPool is needed using the
specified key when delegating.
Parameters: keyedPool - the KeyedObjectPool to delegate to. Parameters: key - the key to use when delegating. | public static KeyedObjectPool | adapt(ObjectPool pool) Adapt an ObjectPool to work where an KeyedObjectPool is needed.
The key is ignored.
Parameters: pool - the ObjectPool to delegate to. | public static TimerTask | checkMinIdle(ObjectPool pool, int minIdle, long period) Periodically check the idle object count for the keyedPool. | public static TimerTask | checkMinIdle(KeyedObjectPool keyedPool, Object key, int minIdle, long period) Periodically check the idle object count for the key in the keyedPool. | public static Map | checkMinIdle(KeyedObjectPool keyedPool, Collection keys, int minIdle, long period) Periodically check the idle object count for each key in the Collection keys in the keyedPool.
At most one idle object will be added per period.
Parameters: keyedPool - the keyedPool to check periodically. Parameters: keys - a collection of keys to check the idle object count. Parameters: minIdle - if the KeyedObjectPool.getNumIdle(Object) is less than this then add an idle object. Parameters: period - the frequency to check the number of idle objects in a keyedPool, seeTimer.schedule(TimerTasklonglong). | public static ObjectPool | checkedPool(ObjectPool pool, Class type) Wraps an ObjectPool and dynamically checks the type of objects borrowed and returned to the keyedPool. | public static KeyedObjectPool | checkedPool(KeyedObjectPool keyedPool, Class type) Wraps an KeyedObjectPool and dynamically checks the type of objects borrowed and returned to the keyedPool. | public static void | prefill(ObjectPool pool, int count) Call addObject() on keyedPool count number of times. | public static void | prefill(KeyedObjectPool keyedPool, Object key, int count) Call addObject(Object) on keyedPool with key count
number of times. | public static void | prefill(KeyedObjectPool keyedPool, Collection keys, int count) Call addObject(Object) on keyedPool with each key in keys for
count number of times. | public static ObjectPool | synchronizedPool(ObjectPool pool) Returns a synchronized (thread-safe) ObjectPool backed by the specified ObjectPool.
Parameters: pool - the ObjectPool to be "wrapped" in a synchronized ObjectPool. | public static KeyedObjectPool | synchronizedPool(KeyedObjectPool keyedPool) Returns a synchronized (thread-safe) KeyedObjectPool backed by the specified KeyedObjectPool.
Parameters: keyedPool - the KeyedObjectPool to be "wrapped" in a synchronized KeyedObjectPool. | public static PoolableObjectFactory | synchronizedPoolableFactory(PoolableObjectFactory factory) Returns a synchronized (thread-safe) PoolableObjectFactory backed by the specified PoolableObjectFactory.
Parameters: factory - the PoolableObjectFactory to be "wrapped" in a synchronized PoolableObjectFactory. | public static KeyedPoolableObjectFactory | synchronizedPoolableFactory(KeyedPoolableObjectFactory keyedFactory) Returns a synchronized (thread-safe) KeyedPoolableObjectFactory backed by the specified KeyedPoolableObjectFactory.
Parameters: keyedFactory - the KeyedPoolableObjectFactory to be "wrapped" in a synchronized KeyedPoolableObjectFactory. |
PoolUtils | public PoolUtils()(Code) | | PoolUtils instances should NOT be constructed in standard programming.
Instead, the class should be used procedurally: PoolUtils.adapt(aPool);.
This constructor is public to permit tools that require a JavaBean instance to operate.
|
checkedPool | public static ObjectPool checkedPool(ObjectPool pool, Class type)(Code) | | Wraps an ObjectPool and dynamically checks the type of objects borrowed and returned to the keyedPool.
If an object is passed to the keyedPool that isn't of type type a
ClassCastException will be thrown.
Parameters: pool - the keyedPool to enforce type safety on an ObjectPool that will only allow objects of type since: Pool 1.3 |
checkedPool | public static KeyedObjectPool checkedPool(KeyedObjectPool keyedPool, Class type)(Code) | | Wraps an KeyedObjectPool and dynamically checks the type of objects borrowed and returned to the keyedPool.
If an object is passed to the keyedPool that isn't of type type a
ClassCastException will be thrown.
Parameters: keyedPool - the keyedPool to enforce type safety on an KeyedObjectPool that will only allow objects of type since: Pool 1.3 |
synchronizedPool | public static ObjectPool synchronizedPool(ObjectPool pool)(Code) | | Returns a synchronized (thread-safe) ObjectPool backed by the specified ObjectPool.
Parameters: pool - the ObjectPool to be "wrapped" in a synchronized ObjectPool. a synchronized view of the specified ObjectPool. since: Pool 1.3 |
synchronizedPool | public static KeyedObjectPool synchronizedPool(KeyedObjectPool keyedPool)(Code) | | Returns a synchronized (thread-safe) KeyedObjectPool backed by the specified KeyedObjectPool.
Parameters: keyedPool - the KeyedObjectPool to be "wrapped" in a synchronized KeyedObjectPool. a synchronized view of the specified KeyedObjectPool. since: Pool 1.3 |
synchronizedPoolableFactory | public static PoolableObjectFactory synchronizedPoolableFactory(PoolableObjectFactory factory)(Code) | | Returns a synchronized (thread-safe) PoolableObjectFactory backed by the specified PoolableObjectFactory.
Parameters: factory - the PoolableObjectFactory to be "wrapped" in a synchronized PoolableObjectFactory. a synchronized view of the specified PoolableObjectFactory. since: Pool 1.3 |
synchronizedPoolableFactory | public static KeyedPoolableObjectFactory synchronizedPoolableFactory(KeyedPoolableObjectFactory keyedFactory)(Code) | | Returns a synchronized (thread-safe) KeyedPoolableObjectFactory backed by the specified KeyedPoolableObjectFactory.
Parameters: keyedFactory - the KeyedPoolableObjectFactory to be "wrapped" in a synchronized KeyedPoolableObjectFactory. a synchronized view of the specified KeyedPoolableObjectFactory. since: Pool 1.3 |
|
|