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.
Periodically check the idle object count for the pool. At most one idle object will be added per period. If there is an exception when calling {@link ObjectPool#addObject()} then no more checks will be performed.
Periodically check the idle object count for the key in the keyedPool. At most one idle object will be added per period. If there is an exception when calling {@link KeyedObjectPool#addObject(Object)} then no more checks for that key will be performed.
Periodically check the idle object count for each key in the <code>Collection</code> <code>keys</code> in the keyedPool. At most one idle object will be added per period.
Should the supplied Throwable be re-thrown (eg if it is an instance of one of the Throwables that should never be swallowed). Used by the pool error handling for operations that throw exceptions that normally need to be ignored.
Returns a pool that adaptively decreases its size when idle objects are no longer needed. This is intended as an always thread-safe alternative to using an idle object evictor provided by many pool implementations. This is also an effective way to shrink FIFO ordered pools that experience load spikes.
Returns a pool that adaptively decreases its size when idle objects are no longer needed. This is intended as an always thread-safe alternative to using an idle object evictor provided by many pool implementations. This is also an effective way to shrink FIFO ordered pools that experience load spikes. <p> The factor parameter provides a mechanism to tweak the rate at which the pool tries to shrink its size. Values between 0 and 1 cause the pool to try to shrink its size more often. Values greater than 1 cause the pool to less frequently try to shrink its size. </p>
Returns a pool that adaptively decreases its size when idle objects are no longer needed. This is intended as an always thread-safe alternative to using an idle object evictor provided by many pool implementations. This is also an effective way to shrink FIFO ordered pools that experience load spikes.
Returns a pool that adaptively decreases its size when idle objects are no longer needed. This is intended as an always thread-safe alternative to using an idle object evictor provided by many pool implementations. This is also an effective way to shrink FIFO ordered pools that experience load spikes. <p> The factor parameter provides a mechanism to tweak the rate at which the pool tries to shrink its size. Values between 0 and 1 cause the pool to try to shrink its size more often. Values greater than 1 cause the pool to less frequently try to shrink its size. </p>
Returns a pool that adaptively decreases its size when idle objects are no longer needed. This is intended as an always thread-safe alternative to using an idle object evictor provided by many pool implementations. This is also an effective way to shrink FIFO ordered pools that experience load spikes. <p> The factor parameter provides a mechanism to tweak the rate at which the pool tries to shrink its size. Values between 0 and 1 cause the pool to try to shrink its size more often. Values greater than 1 cause the pool to less frequently try to shrink its size. </p> <p> The perKey parameter determines if the pool shrinks on a whole pool basis or a per key basis. When perKey is false, the keys do not have an effect on the rate at which the pool tries to shrink its size. When perKey is true, each key is shrunk independently. </p>
Calls {@link ObjectPool#addObject()} on <code>pool</code> <code>count</code> number of times.
Calls {@link KeyedObjectPool#addObject(Object)} on <code>keyedPool</code> with <code>key</code> <code>count</code> number of times.
Calls {@link KeyedObjectPool#addObject(Object)} on <code>keyedPool</code> with each key in <code>keys</code> for <code>count</code> number of times. This has the same effect as calling {@link #prefill(KeyedObjectPool, Object, int)} for each key in the <code>keys</code> collection.
Returns a synchronized (thread-safe) KeyedPooledObjectFactory backed by the specified KeyedPoolableObjectFactory.
Returns a synchronized (thread-safe) ObjectPool backed by the specified ObjectPool. <p> <b>Note:</b> This should not be used on pool implementations that already provide proper synchronization such as the pools provided in the Commons Pool library. Wrapping a pool that {@link #wait() waits} for poolable objects to be returned before allowing another one to be borrowed with another layer of synchronization will cause liveliness issues or a deadlock. </p>
Returns a synchronized (thread-safe) KeyedObjectPool backed by the specified KeyedObjectPool. <p> <b>Note:</b> This should not be used on pool implementations that already provide proper synchronization such as the pools provided in the Commons Pool library. Wrapping a pool that {@link #wait() waits} for poolable objects to be returned before allowing another one to be borrowed with another layer of synchronization will cause liveliness issues or a deadlock. </p>
Returns a synchronized (thread-safe) PooledObjectFactory backed by the specified PooledObjectFactory.
This class consists exclusively of static methods that operate on or return ObjectPool or KeyedObjectPool related interfaces.