org.apache.commons.pool.impl
Class StackKeyedObjectPool
- KeyedObjectPool
public class StackKeyedObjectPool
A simple,
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.
$Revision: 328937 $ $Date: 2005-10-27 15:23:53 -0400 (Thu, 27 Oct 2005) $
addObject , borrowObject , clear , clear , close , getNumActive , getNumActive , getNumIdle , getNumIdle , invalidateObject , returnObject , setFactory |
StackKeyedObjectPool
public StackKeyedObjectPool()
Create a new pool using
no factory. Clients must first populate the pool
using returnObject(java.lang.Object,java.lang.Object)
before they can be borrowed
.
StackKeyedObjectPool
public StackKeyedObjectPool(int max)
Create a new pool using
no factory. Clients must first populate the pool
using returnObject(java.lang.Object,java.lang.Object)
before they can be borrowed
.
max
- cap on the number of "sleeping" instances in the pool
StackKeyedObjectPool
public StackKeyedObjectPool(int max,
int init)
Create a new pool using
no factory. Clients must first populate the pool
using returnObject(java.lang.Object,java.lang.Object)
before they can be borrowed
.
max
- cap on the number of "sleeping" instances in the poolinit
- initial size of the pool (this specifies the size of the container,
it does not cause the pool to be pre-populated.)
StackKeyedObjectPool
public StackKeyedObjectPool(KeyedPoolableObjectFactory factory)
Create a new SimpleKeyedObjectPool using
the specified factory to create new instances.
StackKeyedObjectPool
public 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
public 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.
factory
- the KeyedPoolableObjectFactory
used to populate the poolmax
- cap on the number of "sleeping" instances in the poolinit
- initial size of the pool (this specifies the size of the container,
it does not cause the pool to be pre-populated.)
toString
public String toString()
Copyright © 2001-2003 Apache Software Foundation. Documenation generated March 23 2007.