org.ws4d.java.util
Class ObjectPool
java.lang.Object
org.ws4d.java.util.ObjectPool
public class ObjectPool
- extends java.lang.Object
|
Method Summary |
java.lang.Object |
acquire()
|
void |
release(java.lang.Object o)
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ObjectPool
public ObjectPool(ObjectPool.InstanceCreator creator)
- Creates a new pool with no limit on the maximum number of pooled objects
and an initial pool size of
10.
- Parameters:
creator - the instance creator for creating new pooled objects
ObjectPool
public ObjectPool(ObjectPool.InstanceCreator creator,
int initialSize)
- Creates a new pool with no limit on the total number of pooled objects.
- Parameters:
creator - the instance creator for creating new pooled objectsinitialSize - the initial pool size
ObjectPool
public ObjectPool(ObjectPool.InstanceCreator creator,
int initialSize,
int maxSize)
- Creates a new pool with a maximum total number of pooled objects of
maxSize. The pool will initially have a capacity of
initialSize instances. New instances will be created by the
specified creator.
- Parameters:
creator - the instance creator for creating new pooled objectsinitialSize - the initial pool sizemaxSize - the maximum pool size; if -1, no limit on the
pool size is imposed
acquire
public java.lang.Object acquire()
release
public void release(java.lang.Object o)