Top Description Inners Constructors Methods
io.netty5.util.internal

public abstract Class ObjectPool<T>

extends Object
Class Inheritance
Known Direct Subclasses
io.netty5.util.internal.ObjectPool.RecyclerObjectPool
Type Parameters
<T>
the type of the pooled object
Imports
io.netty5.util.Recycler, java.util.Objects

Light-weight object pool.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public 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.

public static interface
ObjectPool.ObjectCreator<
the type of the pooled object
T
>

Creates a new Object which references the given Handle and calls Handle#recycle(Object) once it can be re-used.

private static class

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public abstract T
get()

Get a Object from the ObjectPool.

public static <T> ObjectPool<T>
newPool(final ObjectPool.ObjectCreator<T> creator)

Creates a new ObjectPool which will use the given ObjectCreator to create the Object that should be pooled.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ObjectPoolback to summary
pack-priv ObjectPool()

Method Detail

getback to summary
public abstract T get()

Get a Object from the ObjectPool. The returned Object may be created via ObjectCreator#newObject(Handle) if no pooled Object is ready to be reused.

newPoolback to summary
public static <T> ObjectPool<T> newPool(final ObjectPool.ObjectCreator<T> creator)

Creates a new ObjectPool which will use the given ObjectCreator to create the Object that should be pooled.

io.netty5.util.internal back to summary

public Interface ObjectPool.Handle<T>

Known Direct Subinterfaces
io.netty5.util.Recycler.Handle

Handle for an pooled Object that will be used to notify the ObjectPool once it can reuse the pooled Object again.

Method Summary

Modifier and TypeMethod and Description
public void
recycle(T self)

Recycle the Object if possible and so make it ready to be reused.

Method Detail

recycleback to summary
public void recycle(T self)

Recycle the Object if possible and so make it ready to be reused.

io.netty5.util.internal back to summary

public Interface ObjectPool.ObjectCreator<T>

Type Parameters
<T>
the type of the pooled object

Creates a new Object which references the given Handle and calls Handle#recycle(Object) once it can be re-used.

Method Summary

Modifier and TypeMethod and Description
public T
newObject(ObjectPool.Handle<T> handle)

Creates an returns a new Object that can be used and later recycled via Handle#recycle(Object).

Method Detail

newObjectback to summary
public T newObject(ObjectPool.Handle<T> handle)

Creates an returns a new Object that can be used and later recycled via Handle#recycle(Object).

io.netty5.util.internal back to summary

private final Class ObjectPool.RecyclerObjectPool<T>

extends ObjectPool<T>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Recycler<T>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public T
get()

Implements abstract io.netty5.util.internal.ObjectPool.get.

Get a Object from the ObjectPool.
Inherited from io.netty5.util.internal.ObjectPool:
newPool

Field Detail

recyclerback to summary
private final Recycler<T> recycler

Constructor Detail

RecyclerObjectPoolback to summary
pack-priv RecyclerObjectPool(final ObjectPool.ObjectCreator<T> creator)

Method Detail

getback to summary
public T get()

Implements abstract io.netty5.util.internal.ObjectPool.get.

Doc from io.netty5.util.internal.ObjectPool.get.

Get a Object from the ObjectPool. The returned Object may be created via ObjectCreator#newObject(Handle) if no pooled Object is ready to be reused.

Annotations
@Override