T
- the type of the pooled objectpublic abstract class ObjectPool<T>
extends java.lang.Object
限定符和类型 | 类和说明 |
---|---|
static interface |
ObjectPool.Handle<T>
Handle for an pooled
Object that will be used to notify the ObjectPool once it can
reuse the pooled Object again. |
static interface |
ObjectPool.ObjectCreator<T>
Creates a new Object which references the given
ObjectPool.Handle and calls ObjectPool.Handle.recycle(Object) once
it can be re-used. |
限定符和类型 | 方法和说明 |
---|---|
abstract T |
get()
Get a
Object from the ObjectPool . |
static <T> ObjectPool<T> |
newPool(ObjectPool.ObjectCreator<T> creator)
Creates a new
ObjectPool which will use the given ObjectPool.ObjectCreator to create the Object
that should be pooled. |
public abstract T get()
Object
from the ObjectPool
. The returned Object
may be created via
ObjectCreator#newObject(Handle)
if no pooled Object
is ready to be reused.public static <T> ObjectPool<T> newPool(ObjectPool.ObjectCreator<T> creator)
ObjectPool
which will use the given ObjectPool.ObjectCreator
to create the Object
that should be pooled.