Class CopyByteBufHandlerChannelInitializer
java.lang.Object
io.servicetalk.transport.netty.internal.CopyByteBufHandlerChannelInitializer
- All Implemented Interfaces:
ChannelInitializer
public final class CopyByteBufHandlerChannelInitializer
extends Object
implements ChannelInitializer
Initializer to configure
ChannelInboundHandler that will ensure no pooled ByteBufs are passed to
the user and so no leaks are produced if the user does not call ReferenceCountUtil.release(Object).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.netty.buffer.PooledByteBufAllocatorPooledByteBufAllocatorto use internally when we know memory won't be leaked. -
Constructor Summary
ConstructorsConstructorDescriptionCopyByteBufHandlerChannelInitializer(io.netty.buffer.ByteBufAllocator unpooledAllocator) Creates a new instance. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.servicetalk.transport.netty.internal.ChannelInitializer
andThen
-
Field Details
-
POOLED_ALLOCATOR
public static final io.netty.buffer.PooledByteBufAllocator POOLED_ALLOCATORPooledByteBufAllocatorto use internally when we know memory won't be leaked.
-
-
Constructor Details
-
CopyByteBufHandlerChannelInitializer
public CopyByteBufHandlerChannelInitializer(io.netty.buffer.ByteBufAllocator unpooledAllocator) Creates a new instance.- Parameters:
unpooledAllocator-ByteBufAllocatorto allocate unpooled memory.- Throws:
IllegalArgumentException- if the providedunpooledAllocatoris not unpooled.
-
-
Method Details
-
init
public void init(io.netty.channel.Channel channel) Description copied from interface:ChannelInitializerConfigures the passedChannel.Typically, an initializer should add handlers to the channel at the end. This makes it possible for the code using the initializer to create the order of the handlers in the pipeline.
- Specified by:
initin interfaceChannelInitializer- Parameters:
channel- NettyChannel.
-
handlerClass
ReturnClassof theChannelHandlerin case there is a need to remove the handler from theChannelPipeline.- Returns:
Classof theChannelHandlerin case there is a need to remove the handler from theChannelPipeline.
-