Class CopyByteBufHandlerChannelInitializer

  • All Implemented Interfaces:
    ChannelInitializer

    public final class CopyByteBufHandlerChannelInitializer
    extends java.lang.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

      Fields 
      Modifier and Type Field Description
      static io.netty.buffer.PooledByteBufAllocator POOLED_ALLOCATOR
      PooledByteBufAllocator to use internally when we know memory won't be leaked.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void init​(io.netty.channel.Channel channel)
      Configures the passed Channel.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • POOLED_ALLOCATOR

        public static final io.netty.buffer.PooledByteBufAllocator POOLED_ALLOCATOR
        PooledByteBufAllocator to use internally when we know memory won't be leaked.
    • Constructor Detail

      • CopyByteBufHandlerChannelInitializer

        public CopyByteBufHandlerChannelInitializer​(io.netty.buffer.ByteBufAllocator unpooledAllocator)
        Creates a new instance.
        Parameters:
        unpooledAllocator - ByteBufAllocator to allocate unpooled memory.
        Throws:
        java.lang.IllegalArgumentException - if the provided unpooledAllocator is not unpooled.
    • Method Detail

      • init

        public void init​(io.netty.channel.Channel channel)
        Description copied from interface: ChannelInitializer
        Configures the passed 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.

        Specified by:
        init in interface ChannelInitializer
        Parameters:
        channel - Netty Channel.