|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.sapportals.portal.prt.util.AbstractPool
Manages a pool of objects.
Unused objects are removed after a certain period of time.
The maximum number of objects managed by the pool is by default 100.
This property can be overriden when constructing the pool
| Field Summary | |
protected int |
mm_maxPoolSize
|
protected java.util.List |
mm_unlocked
Contains pool objects that are available for use |
| Constructor Summary | |
AbstractPool(int initialCapacity)
Construct a pool given an initial capacity and the maximum number set to 100 to manage |
|
AbstractPool(int initialCapacity,
int nbInitialInstance)
Construct a pool given an initial capacity and the number of initial items to manage |
|
AbstractPool(int initialCapacity,
int nbInitialInstance,
int maxNumberObjects)
Construct a pool given an initial capacity and the maximum number of items to manage |
|
| Method Summary | |
protected abstract java.lang.Object |
createPoolObject()
Factory method to create pool objects |
protected abstract void |
expirePoolObject(java.lang.Object o)
Callback when object are not managed anymore by the pool. |
java.lang.Object |
getPoolObject()
Returns an object from the pool. If no object was available, the object factory is called to instantiate an object |
void |
releasePoolObject(java.lang.Object o)
Tells the pool to release an object and make it available in the pool. |
protected abstract boolean |
validatePoolObject(java.lang.Object o)
Method called to validate an object that has been put back in the pool |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected int mm_maxPoolSize
protected java.util.List mm_unlocked
| Constructor Detail |
public AbstractPool(int initialCapacity)
initialCapacity - the initial container capacity
public AbstractPool(int initialCapacity,
int nbInitialInstance)
initialCapacity - the initial container capacity. You should here choose
a value that is as close as the given maxNumberObjects.nbInitialInstance - the initial number of objects to manage in the pool
public AbstractPool(int initialCapacity,
int nbInitialInstance,
int maxNumberObjects)
initialCapacity - the initial container capacity. You should here choose
a value that is as close as the given maxNumberObjects.nbInitialInstance - the initial number of objects to manage in the poolmaxNumberObjects - the maximum number of objects to manage in the pool. value -1 means infinite.| Method Detail |
protected abstract java.lang.Object createPoolObject()
throws java.lang.Exception
java.lang.Exception - protected abstract boolean validatePoolObject(java.lang.Object o)
o - the object to validateprotected abstract void expirePoolObject(java.lang.Object o)
o - the object that is to be expired
public java.lang.Object getPoolObject()
throws java.lang.Exception
java.lang.Exception - public void releasePoolObject(java.lang.Object o)
o - the object to release.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||