|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jacorb.notification.util.AbstractObjectPool
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! This class needs a two phase initialization: configure MUST be invoked before an instance can be used.
Field Summary | |
---|---|
protected org.apache.avalon.framework.configuration.Configuration |
config_
|
static boolean |
DEBUG
|
static int |
INITIAL_SIZE_DEFAULT
|
protected org.apache.avalon.framework.logger.Logger |
logger_
|
static int |
LOWER_WATERMARK_DEFAULT
|
static int |
MAXIMUM_SIZE_DEFAULT
|
static int |
MAXIMUM_WATERMARK_DEFAULT
|
static int |
SIZE_INCREASE_DEFAULT
|
static long |
SLEEP
time the cleaner thread sleeps between two cleanups |
Constructor Summary | |
---|---|
protected |
AbstractObjectPool(java.lang.String name)
|
protected |
AbstractObjectPool(java.lang.String name,
int lowerWatermark,
int sizeincrease,
int initialsize,
int maxWatermark,
int maximumSize)
|
Method Summary | |
---|---|
void |
configure(org.apache.avalon.framework.configuration.Configuration conf)
|
void |
dispose()
Release this Pool. |
void |
doActivateObject(java.lang.Object o)
Is called before Object is returned to Client (lendObject). |
void |
doDestroyObject(java.lang.Object o)
Is called if Pool is full and returned Object is discarded. |
void |
doPassivateObject(java.lang.Object o)
Is called after Object is returned to pool. |
protected boolean |
isCreationAllowed()
check if it is allowed to create more instances. |
java.lang.Object |
lendObject()
lend an object from the pool. |
abstract java.lang.Object |
newInstance()
This method is called by the Pool to create a new Instance. |
protected void |
poolIsEmpty()
|
void |
returnObject(java.lang.Object o)
return an Object to the pool. |
void |
run()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final boolean DEBUG
public static final long SLEEP
public static final int LOWER_WATERMARK_DEFAULT
public static final int SIZE_INCREASE_DEFAULT
public static final int INITIAL_SIZE_DEFAULT
public static final int MAXIMUM_WATERMARK_DEFAULT
public static final int MAXIMUM_SIZE_DEFAULT
protected final org.apache.avalon.framework.logger.Logger logger_
protected org.apache.avalon.framework.configuration.Configuration config_
Constructor Detail |
protected AbstractObjectPool(java.lang.String name)
protected AbstractObjectPool(java.lang.String name, int lowerWatermark, int sizeincrease, int initialsize, int maxWatermark, int maximumSize)
Method Detail |
public void configure(org.apache.avalon.framework.configuration.Configuration conf)
configure
in interface org.apache.avalon.framework.configuration.Configurable
public void run()
run
in interface java.lang.Runnable
public void dispose()
public java.lang.Object lendObject()
protected boolean isCreationAllowed()
protected void poolIsEmpty()
public void returnObject(java.lang.Object o)
public java.lang.String toString()
public abstract java.lang.Object newInstance()
public void doPassivateObject(java.lang.Object o)
public void doActivateObject(java.lang.Object o)
public void doDestroyObject(java.lang.Object o)
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |