|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.d_haven.mpool.AbstractPool
org.d_haven.mpool.FixedSizePool
public final class FixedSizePool
This is an Pool that caches Poolable objects for reuse.
Please note that this pool offers no resource limiting whatsoever.
| Field Summary | |
|---|---|
private java.util.List |
m_buffer
|
private boolean |
m_disposed
|
private long |
m_stepTime
|
private long |
m_timeout
|
| Constructor Summary | |
|---|---|
FixedSizePool(ObjectFactory factory,
int size)
Create a fixed size pool using the object factory and size supplied. |
|
FixedSizePool(ObjectFactory factory,
int size,
long timeout)
Create a fixed size pool using the object factory, size, and timeout supplied. |
|
| Method Summary | |
|---|---|
void |
dispose()
Dispose this pool and remove all elements. |
protected java.lang.Object |
doAcquire()
Perform the actual work of acquiring the object from the pool. |
protected boolean |
doRelease(java.lang.Object object)
Perform the actual logic to release the pooled object back to the pool. |
long |
getTimeout()
Get the timeout in milliseconds for this pool. |
private java.lang.Object |
popLast()
|
java.lang.String |
toString()
|
| Methods inherited from class org.d_haven.mpool.AbstractPool |
|---|
acquire, addPoolListener, disposeInstance, fireAquiredEvent, fireCreatedEvent, fireCreationFailedEvent, fireDisposedEvent, fireDisposeFailedEvent, fireReleasedEvent, getPoolListeners, newInstance, release, removePoolListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private boolean m_disposed
private final java.util.List m_buffer
private final long m_timeout
private final long m_stepTime
| Constructor Detail |
|---|
public FixedSizePool(ObjectFactory factory,
int size)
throws java.lang.Exception
factory - the factory to use for the poolsize - the number of items in the pool (hard limit)
java.lang.Exception - if there is a problem creating any of the items
in the pool
public FixedSizePool(ObjectFactory factory,
int size,
long timeout)
throws java.lang.Exception
factory - the factory to use for the poolsize - the number of items in the pool (hard limit)timeout - the timeout in milliseconds to use.
java.lang.Exception - if there is a problem creating any of the items
in the pool| Method Detail |
|---|
protected java.lang.Object doAcquire()
throws java.lang.Exception
AbstractPool
doAcquire in class AbstractPooljava.lang.Exception - if there was a problem acquiring the objectprivate java.lang.Object popLast()
protected boolean doRelease(java.lang.Object object)
AbstractPool
doRelease in class AbstractPoolobject - the object to release
true if we also need to dispose of the
objectpublic void dispose()
public java.lang.String toString()
toString in class java.lang.Objectpublic long getTimeout()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||