|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.core.util.ObjectPool<T>
T
- any class whose objects are stored in the poolpublic class ObjectPool<T>
Implements a simple pool for reusable objects. The pool can be divided into several sub pools, e.g. if the objects have different "sizes". If memory becomes scarce some of the sub pools may get garbage collected, but this is transparent.
Constructor Summary | |
---|---|
ObjectPool(int subPools,
int maxSizes)
Creates a new object pool. |
Method Summary | |
---|---|
T |
get(int subPool)
Returns an object from the (sub) pool, or null if the pool
is empty. |
void |
printStats(PrintStream out)
Prints statistics about hits and misses. |
void |
recycle(T object,
int subPool)
Puts an object into the specified subpool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectPool(int subPools, int maxSizes)
subPools
- the number of sub poolsmaxSizes
- the maximum size of each sub poolMethod Detail |
---|
public T get(int subPool)
null
if the pool
is empty.
subPool
- the number of the sub pool, starting with 0
null
public void recycle(T object, int subPool)
object
- an object to storesubPool
- the index of the sub pool (starting with 0)public void printStats(PrintStream out)
out
- a print stream to which the statistic should be written
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |