|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jgap.impl.Pool
public class Pool
A simple, generic pool class that can be used to pool any kind of object. Objects can be released to this pool, either individually or as a Collection, and then later acquired again. It is not necessary for an object to have been originally acquired from the pool in order for it to be released to the pool. If there are no objects present in the pool, an attempt to acquire one will return null. The number of objects available in the pool can be determined with the size() method. Finally, it should be noted that the pool does not attempt to perform any kind of cleanup or re-initialization on the objects to restore them to some clean state when they are released to the pool; it's up to the user to reset any necessary state in the object prior to the release call (or just after the acquire call).
Constructor Summary | |
---|---|
Pool()
Constructor. |
Method Summary | |
---|---|
java.lang.Object |
acquirePooledObject()
Attempts to acquire an Object instance from the pool. |
void |
clear()
Empties out this pool of all objects. |
void |
releaseAllObjects(java.util.Collection a_objectsToPool)
Releases a Collection of objects to the pool. |
void |
releaseObject(java.lang.Object a_objectToPool)
Releases an Object to the pool. |
int |
size()
Retrieves the number of objects currently available in this pool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Pool()
Method Detail |
---|
public java.lang.Object acquirePooledObject()
public void releaseObject(java.lang.Object a_objectToPool)
a_objectToPool
- The Object instance to be released into the pool.public void releaseAllObjects(java.util.Collection a_objectsToPool)
a_objectsToPool
- The Collection of objects to release into the pool.public int size()
public void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |