org.jacorb.notification.util
Class AbstractObjectPool
java.lang.Object
org.jacorb.notification.util.AbstractObjectPool
- Configurable, Runnable
public abstract class AbstractObjectPool
extends java.lang.Object
implements Runnable, Configurable
Abstract Base Class for Simple Pooling Mechanism. Subclasses must
at least implement the method newInstance. To use a Object call
lendObject. After use the Object must be returned with
returnObject(Object). An Object must not be used after it has been
returned to its pool!
Version:
- Alphonse Bendt
DEBUG
public static final boolean DEBUG
- false
INITIAL_SIZE_DEFAULT
public static final int INITIAL_SIZE_DEFAULT
- 100
LOWER_WATERMARK_DEFAULT
public static final int LOWER_WATERMARK_DEFAULT
- 30
MAXIMUM_WATERMARK_DEFAULT
public static final int MAXIMUM_WATERMARK_DEFAULT
- 1000
SIZE_INCREASE_DEFAULT
public static final int SIZE_INCREASE_DEFAULT
- 30
SLEEP
public static final long SLEEP
time the cleaner thread sleeps between two cleanups
- 100L
logger_
protected Logger logger_
AbstractObjectPool
protected AbstractObjectPool(String name)
AbstractObjectPool
protected AbstractObjectPool(String name,
int threshold,
int sizeincrease,
int initialsize,
int maxsize)
activateObject
public void activateObject(Object o)
Is called before Object is returned to Client (lendObject). No Op
configure
public void configure(Configuration conf)
destroyObject
public void destroyObject(Object o)
Is called if Pool is full and Object is discarded. No Op.
dispose
public void dispose()
Release this Pool.
init
public void init()
Initialize this Pool. An initial Number of Objects is
created. Cleanup Thread is started.
lendObject
public Object lendObject()
lend an object from the pool.
newInstance
public Object newInstance()
This method is called by the Pool to create a new
Instance. Subclasses must override appropiately .
passivateObject
public void passivateObject(Object o)
Is called after Object is returned to pool. No Op.
returnObject
public void returnObject(Object o)
return an Object to the pool.