|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--com.ls.util.Pool
Provides a pool of Objects.
| Field Summary | |
protected List |
indexPool
Pool of indexes to indicate which objects are available. |
protected static Boolean |
OBJECT_AVAILABLE
Status: object is available. |
protected static Boolean |
OBJECT_NOT_AVAILABLE
Status: object is not available. |
protected List |
objectPool
Pool of objects. |
protected int |
poolSize
Normal pool size. |
| Constructor Summary | |
Pool(int defaultPoolSize)
Creates a new pool object and set the normal pool size. |
|
Pool(List newObjectPool)
Creates a new pool object and fills it with the given vector (pool). |
|
| Method Summary | |
void |
check(IPoolObjectValidationCheckStrategy strategy)
This method allows the user to specify an algorithm (strategy) for checking all pool objects by implementing the interface IPoolObjectValidationCheckStrategy. |
Object |
get()
Returns (removes) an object from the pool. |
boolean |
put(Object newObject)
This method adds an object to the pool, but only if the object is not null. |
boolean |
replace(Object oldObject,
Object newObject)
Replaces the old object with the new one. |
void |
setPoolSize(int newPoolSize)
Sets the normal pool size. NOTE: It doesn't set the current pool size! |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected List objectPool
protected List indexPool
protected int poolSize
protected static final Boolean OBJECT_AVAILABLE
protected static final Boolean OBJECT_NOT_AVAILABLE
| Constructor Detail |
public Pool(int defaultPoolSize)
defaultPoolSize - The default pool size.
public Pool(List newObjectPool)
throws IllegalArgumentException
newObjectPool - The new pool.IllegalArgumentException - If parameter newObjectPool is null.| Method Detail |
public boolean put(Object newObject)
throws IllegalArgumentException
newObject - The new object.IllegalArgumentException - If parameter newObject is null.
public Object get()
throws PoolObjectNotAvailableException
PoolObjectNotAvailableException - If there is no more pool object available.
public boolean replace(Object oldObject,
Object newObject)
throws IllegalArgumentException
oldObject - The old object.newObject - The new object.IllegalArgumentException - If one parameter is null.public void check(IPoolObjectValidationCheckStrategy strategy)
IPoolObjectValidationCheckStrategy.strategy - User defined strategy for checking all pool objects.public void setPoolSize(int newPoolSize)
newPoolSize - The new pool size.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||