T
- the type of the pooled objectpublic abstract class ObjectPool<T> extends Object
Modifier and Type | Class and Description |
---|---|
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. |
Modifier and Type | Method and Description |
---|---|
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.Copyright © 2008–2024 The Netty Project. All rights reserved.