|
PooliT v2.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ascentphase.poolit.poolers.FixedPooler
This Pooler implements a fixed-sized pool. The pool is initialized to a fixed size and filled to the fixed capacity upon creation. Objects are fetched from the pool and if no more objects exist in the pool, new objects are created by calling the associated PoolHandler's create() method.
Pooler| Field Summary | |
protected int |
availPos
Points to the index in the pool array where the next available object can be retrieved from. |
protected PoolHandler |
handler
|
protected java.lang.Object[] |
pool
|
| Constructor Summary | |
FixedPooler(java.lang.Class name,
int size)
Creates a pool with the specified class and size. |
|
FixedPooler(PoolHandler handler,
int size)
Creates a pool using the specified handler and size. |
|
| Method Summary | |
int |
capacity()
Reports the maximum number of objects this pool can contain. |
void |
close()
Destroys all objects in the pool. |
java.lang.Object |
fetch()
Retrieves an object from the pool. |
protected void |
fillPool()
Called by constructor to fill up the pool. |
void |
release(java.lang.Object o)
Returns an object to the pool. |
void |
resize(int newsize)
Changes the size of the pool. |
int |
size()
Reports the number of objects currently in the pool. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.Object[] pool
protected PoolHandler handler
protected int availPos
| Constructor Detail |
public FixedPooler(java.lang.Class name,
int size)
throws CreateException
name - class to be pooledsize - size of pool to be created
public FixedPooler(PoolHandler handler,
int size)
throws CreateException
handler - PoolHandler to be used by this poolsize - size of pool to be created| Method Detail |
public java.lang.Object fetch()
throws FetchException
Pooler
fetch in interface PoolerFetchException - if the pooler is unable to return an object from
the pool.public void release(java.lang.Object o)
Pooler
release in interface Poolero - the objectpublic int size()
public int capacity()
public void resize(int newsize)
newsize - the new size of the pool
protected void fillPool()
throws CreateException
CreateExceptionpublic void close()
close in interface PoolerPooler.close()
|
PooliT v2.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||