|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.cau.cs.kieler.core.alg.InstancePool<T>
T
- the type of instances that are held by this poolpublic class InstancePool<T>
A pool for class instances.
Field Summary | |
---|---|
static int |
INFINITE
an infinite amount of instances. |
Constructor Summary | |
---|---|
InstancePool(IFactory<T> thefactory)
Create an instance pool with an infinite capacity. |
|
InstancePool(IFactory<T> thefactory,
int thelimit)
Create an instance pool with given capacity. |
Method Summary | |
---|---|
void |
clear()
Clear the instance pool by disposing all instances that are currently held. |
T |
fetch()
Fetch an instance from the pool. |
void |
release(T obj)
Release an instance into the pool to be used again. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int INFINITE
Constructor Detail |
---|
public InstancePool(IFactory<T> thefactory)
thefactory
- the instance factorypublic InstancePool(IFactory<T> thefactory, int thelimit)
thefactory
- the instance factorythelimit
- the maximal number of instances that shall be kept in the poolMethod Detail |
---|
public T fetch()
public void release(T obj)
obj
- a class instancepublic void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |