org.apache.commons.pool.impl
public class StackKeyedObjectPool extends BaseKeyedObjectPool implements KeyedObjectPool
java.util.Stack Stack
-based KeyedObjectPool implementation.
Given a KeyedPoolableObjectFactory, this class will maintain a simple pool of instances. A finite number of "sleeping" or inactive instances is enforced, but when the pool is empty, new instances are created to support the new load. Hence this class places no limit on the number of "active" instances created by the pool, but is quite useful for re-using Objects without introducing artificial limits.
Version: $Revision: 328937 $ $Date: 2005-10-27 15:23:53 -0400 (Thu, 27 Oct 2005) $
Constructor Summary | |
---|---|
StackKeyedObjectPool()
Create a new pool using
no factory. | |
StackKeyedObjectPool(int max)
Create a new pool using
no factory. | |
StackKeyedObjectPool(int max, int init)
Create a new pool using
no factory. | |
StackKeyedObjectPool(KeyedPoolableObjectFactory factory)
Create a new SimpleKeyedObjectPool using
the specified factory to create new instances.
| |
StackKeyedObjectPool(KeyedPoolableObjectFactory factory, int max)
Create a new SimpleKeyedObjectPool using
the specified factory to create new instances.
capping the number of "sleeping" instances to max
| |
StackKeyedObjectPool(KeyedPoolableObjectFactory factory, int max, int init)
Create a new SimpleKeyedObjectPool using
the specified factory to create new instances.
capping the number of "sleeping" instances to max,
and initially allocating a container capable of containing
at least init instances.
|
Method Summary | |
---|---|
void | addObject(Object key) |
Object | borrowObject(Object key) |
void | clear() |
void | clear(Object key) |
void | close() |
int | getNumActive() |
int | getNumActive(Object key) |
int | getNumIdle() |
int | getNumIdle(Object key) |
void | invalidateObject(Object key, Object obj) |
void | returnObject(Object key, Object obj) |
void | setFactory(KeyedPoolableObjectFactory factory) |
String | toString() |
borrowed
. borrowed
.
Parameters: max cap on the number of "sleeping" instances in the pool
borrowed
.
Parameters: max cap on the number of "sleeping" instances in the pool init initial size of the pool (this specifies the size of the container, it does not cause the pool to be pre-populated.)
Parameters: factory the KeyedPoolableObjectFactory used to populate the pool
Parameters: factory the KeyedPoolableObjectFactory used to populate the pool max cap on the number of "sleeping" instances in the pool
Parameters: factory the KeyedPoolableObjectFactory used to populate the pool max cap on the number of "sleeping" instances in the pool init initial size of the pool (this specifies the size of the container, it does not cause the pool to be pre-populated.)