public final class CopyByteBufHandlerChannelInitializer extends java.lang.Object implements ChannelInitializer
ChannelInboundHandler
that will ensure no pooled ByteBuf
s are passed to
the user and so no leaks are produced if the user does not call ReferenceCountUtil.release(Object)
.Modifier and Type | Field and Description |
---|---|
static io.netty.buffer.PooledByteBufAllocator |
POOLED_ALLOCATOR
PooledByteBufAllocator to use internally when we know memory won't be leaked. |
Constructor and Description |
---|
CopyByteBufHandlerChannelInitializer(io.netty.buffer.ByteBufAllocator unpooledAllocator)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
init(io.netty.channel.Channel channel)
Configures the passed
Channel . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
andThen, defaultInitializer
public static final io.netty.buffer.PooledByteBufAllocator POOLED_ALLOCATOR
PooledByteBufAllocator
to use internally when we know memory won't be leaked.public CopyByteBufHandlerChannelInitializer(io.netty.buffer.ByteBufAllocator unpooledAllocator)
unpooledAllocator
- ByteBufAllocator
to allocate unpooled memory.java.lang.IllegalArgumentException
- if the provided unpooledAllocator
is not unpooled.public void init(io.netty.channel.Channel channel)
ChannelInitializer
Channel
.
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.
init
in interface ChannelInitializer
channel
- Netty Channel
.