T - the type of instances to be managedpublic class Pool<T>
extends java.lang.Object
IPoolManager delegate.| Modifier and Type | Field and Description |
|---|---|
private IPoolManager<T> |
manager |
private java.util.List<T> |
pool |
| Constructor and Description |
|---|
Pool(IPoolManager<T> manager)
Creates a new pool for a given type of instances represented by its
pool manager.
|
| Modifier and Type | Method and Description |
|---|---|
private boolean |
containsByRef(T instance)
Returns whether the pool already contains
instance. |
T |
getInstance()
Returns an instance from the pool or creates a new instance via the
manager. |
void |
releaseInstance(T instance)
Releases an
instance obtained from #get(). |
private IPoolManager<T> manager
private java.util.List<T> pool
public Pool(IPoolManager<T> manager)
manager - the pool managerpublic T getInstance()
manager.public void releaseInstance(T instance)
instance obtained from #get().instance - the instance to be released (ignored if null)private boolean containsByRef(T instance)
instance.instance - the instance to look for (by reference)true if the reference is already there, false elseCopyright © 2009 - 2018 SSE. All Rights Reserved.