|
Protomatter Software v1.1.7 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.protomatter.pool.SimpleObjectPool
A minimal implementation of an ObjectPool. This class provides a non-growing pool that sleeps the threads that are trying to check something out of the pool, and wakes them up in-order when something is checked back in.
ObjectPool
Field Summary | |
protected java.lang.Object |
sync
|
Constructor Summary | |
SimpleObjectPool()
Initialize the object pool. |
|
SimpleObjectPool(boolean monitorCheckedOutObjects)
Initialize the object pool. |
Method Summary | |
void |
checkin(ObjectPoolObject opo)
Check an object back into the pool. |
protected abstract void |
checkinPoolObject(ObjectPoolObject o)
This method needs to be implemented by sub-classes. |
ObjectPoolObject |
checkout()
Implements a first in, first out reservation scheme. |
protected abstract ObjectPoolObject |
createObjectPoolObject()
To be implemented by sub-classes. |
protected java.util.List |
getCheckedOutObjects()
Get the list of objects that are currently checked out of the pool. |
protected abstract ObjectPoolObject |
getNextPoolObject()
This method needs to be implemented by sub-classes. |
int |
getNumWaiters()
Get the number of threads waiting for an object to become available. |
int |
getObjectsInUse()
Get the number of objects that are currently checked out. |
protected java.lang.Object |
getSyncObject()
Get a reference to the object being used as a synchronization lock. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.protomatter.pool.ObjectPool |
init, reInitializeObjectPool |
Field Detail |
protected java.lang.Object sync
Constructor Detail |
public SimpleObjectPool()
public SimpleObjectPool(boolean monitorCheckedOutObjects)
Method Detail |
protected java.lang.Object getSyncObject()
public int getNumWaiters()
public int getObjectsInUse()
getObjectsInUse
in interface ObjectPool
public ObjectPoolObject checkout() throws java.lang.Exception
checkout
in interface ObjectPool
java.lang.Exception
- If there is a problem checking an object out of the pool.public void checkin(ObjectPoolObject opo) throws java.lang.Exception
checkin
in interface ObjectPool
java.lang.Exception
- If there was a problem checking in the object.protected java.util.List getCheckedOutObjects()
protected abstract ObjectPoolObject getNextPoolObject() throws java.lang.Exception
java.lang.Exception
- If there is a problem getting the
next object for the pool -- this is implementation specific.protected abstract void checkinPoolObject(ObjectPoolObject o) throws java.lang.Exception
java.lang.Exception
- If there is a problem checking in the
object -- this is implementation specific.protected abstract ObjectPoolObject createObjectPoolObject() throws java.lang.Exception
java.lang.Exception
- If there is a problem creating the next
object for the pool -- this is implementation specific.
|
Protomatter Software v1.1.7 Copyright 1998-2002 Nate Sammons |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Protomatter Software v1.1.7 | http://protomatter.sourceforge.net/1.1.7 |