Package io.netty.util.internal
Class ObjectPool<T>
java.lang.Object
io.netty.util.internal.ObjectPool<T>
- Type Parameters:
T
- the type of the pooled object
- Direct Known Subclasses:
ObjectPool.RecyclerObjectPool
Light-weight object pool.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Handle for an pooledObject
that will be used to notify theObjectPool
once it can reuse the pooledObject
again.static interface
Creates a new Object which references the givenObjectPool.Handle
and callsObjectPool.Handle.recycle(Object)
once it can be re-used.private static final class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract T
get()
Get aObject
from theObjectPool
.static <T> ObjectPool
<T> newPool
(ObjectPool.ObjectCreator<T> creator) Creates a newObjectPool
which will use the givenObjectPool.ObjectCreator
to create theObject
that should be pooled.
-
Constructor Details
-
ObjectPool
ObjectPool()
-
-
Method Details
-
get
Get aObject
from theObjectPool
. The returnedObject
may be created viaObjectPool.ObjectCreator.newObject(Handle)
if no pooledObject
is ready to be reused. -
newPool
Creates a newObjectPool
which will use the givenObjectPool.ObjectCreator
to create theObject
that should be pooled.
-