org.activemath.omdocjdom
Class SimplePool
java.lang.Object
org.activemath.omdocjdom.SimplePool
- Direct Known Subclasses:
- SimplePoolPassive
public class SimplePool
- extends Object
Simple pool class with objects that have a life and death.
- Version:
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
factory
protected SimplePool.PoolableFactory factory
baseNum
protected int baseNum
poolables
protected List poolables
lastFinished
protected SimplePool.Poolable lastFinished
SimplePool
public SimplePool(SimplePool.PoolableFactory factory,
int size)
SimplePool
protected SimplePool()
getAFreeOne
public SimplePool.Poolable getAFreeOne(int timeout,
int interval)
throws InterruptedException
- Throws:
InterruptedException
getAFreeOne
public SimplePool.Poolable getAFreeOne()
- Searches a free one waiting eternally,
returns
null if the thread was
interrupted.
getAFreeOneInternal
protected SimplePool.Poolable getAFreeOneInternal()
use
public void use(SimplePool.Poolable poolable)
- Currently does nothing but call the
SimplePool.Poolable.run()
but may, in the future, have a better freeness-flag modification.
justStart
public void justStart(SimplePool.Poolable poolable)
waitTillAllFinished
public boolean waitTillAllFinished(long timeout,
int interval)
destroy
public void destroy(long timeout)
- Waits until they're all finished for timeout miliseconds then
destroys them all. Invokes the destroy method in a new thread.