- java.lang.Object
-
- io.netty5.util.internal.ObjectPool<T>
-
- Type Parameters:
T- the type of the pooled object
public abstract class ObjectPool<T> extends Object
Light-weight object pool.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceObjectPool.Handle<T>Handle for an pooledObjectthat will be used to notify theObjectPoolonce it can reuse the pooledObjectagain.static interfaceObjectPool.ObjectCreator<T>Creates a new Object which references the givenObjectPool.Handleand callsObjectPool.Handle.recycle(Object)once it can be re-used.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Tget()Get aObjectfrom theObjectPool.static <T> ObjectPool<T>newPool(ObjectPool.ObjectCreator<T> creator)Creates a newObjectPoolwhich will use the givenObjectPool.ObjectCreatorto create theObjectthat should be pooled.
-
-
-
Method Detail
-
get
public abstract T get()
Get aObjectfrom theObjectPool. The returnedObjectmay be created viaObjectPool.ObjectCreator.newObject(Handle)if no pooledObjectis ready to be reused.
-
newPool
public static <T> ObjectPool<T> newPool(ObjectPool.ObjectCreator<T> creator)
Creates a newObjectPoolwhich will use the givenObjectPool.ObjectCreatorto create theObjectthat should be pooled.
-
-