|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.crankuptheamps.client.Pool<T>
T
- The pooled type.public class Pool<T>
A simple generic instance pool for objects that take a while to construct.
Constructor Summary | |
---|---|
Pool(Class<T> theClass,
int initialSize)
Constructs a pool with the given size |
Method Summary | |
---|---|
T |
get()
Returns an object from the pool, growing self if necessary (by initialSize). |
void |
returnToPool(T theInstance)
Return an object to the pool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Pool(Class<T> theClass, int initialSize)
theClass
- The Class pooled. Should always be T.class. Sorry we can't do this ourselves.initialSize
- The initial size of the pool. If you pass a value less than 1, we'll just use 1.Method Detail |
---|
public T get()
public void returnToPool(T theInstance)
theInstance
- The T to return to the pool.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |