Class AutoReadFlowControlHandler

  • All Implemented Interfaces:
    io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler

    public class AutoReadFlowControlHandler
    extends io.netty.channel.ChannelDuplexHandler
    Keeps a counter of messages that have been sent down the pipeline. That counter is decremented whenever a read is requested. A read is only propagated to the channel when all messages have completed. This handler is intended to be used with NettyConnection.AutoReadEventHandler.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

        io.netty.channel.ChannelHandler.Sharable
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void channelRead​(io.netty.channel.ChannelHandlerContext ctx, Object msg)  
      void read​(io.netty.channel.ChannelHandlerContext ctx)  
      • Methods inherited from class io.netty.channel.ChannelDuplexHandler

        bind, close, connect, deregister, disconnect, flush, write
      • Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

        channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
      • Methods inherited from class io.netty.channel.ChannelHandlerAdapter

        ensureNotSharable, handlerAdded, handlerRemoved, isSharable
      • Methods inherited from interface io.netty.channel.ChannelHandler

        handlerAdded, handlerRemoved
    • Field Detail

      • logger

        protected final Logger logger
        Logger for this class.
      • messageCount

        private final AtomicInteger messageCount
        Number of messages in the pipeline.
    • Constructor Detail

      • AutoReadFlowControlHandler

        public AutoReadFlowControlHandler()
    • Method Detail

      • channelRead

        public void channelRead​(io.netty.channel.ChannelHandlerContext ctx,
                                Object msg)
                         throws Exception
        Specified by:
        channelRead in interface io.netty.channel.ChannelInboundHandler
        Overrides:
        channelRead in class io.netty.channel.ChannelInboundHandlerAdapter
        Throws:
        Exception
      • read

        public void read​(io.netty.channel.ChannelHandlerContext ctx)
                  throws Exception
        Specified by:
        read in interface io.netty.channel.ChannelOutboundHandler
        Overrides:
        read in class io.netty.channel.ChannelDuplexHandler
        Throws:
        Exception