Class RntbdRequestManager

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

    public final class RntbdRequestManager
    extends Object
    implements io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler
    • Nested Class Summary

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

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

      Constructors 
      Constructor Description
      RntbdRequestManager​(io.netty.channel.pool.ChannelHealthChecker healthChecker, int pendingRequestLimit)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void bind​(io.netty.channel.ChannelHandlerContext context, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)
      Called once a bind operation is made.
      void channelActive​(io.netty.channel.ChannelHandlerContext context)
      The Channel of the ChannelHandlerContext is now active
      void channelInactive​(io.netty.channel.ChannelHandlerContext context)
      The Channel of the ChannelHandlerContext was registered and has reached the end of its lifetime
      void channelRead​(io.netty.channel.ChannelHandlerContext context, Object message)
      The Channel of the ChannelHandlerContext has read a message from its peer.
      void channelReadComplete​(io.netty.channel.ChannelHandlerContext context)
      The Channel of the ChannelHandlerContext has fully consumed the most-recent message read.
      void channelRegistered​(io.netty.channel.ChannelHandlerContext context)
      Constructs a CoalescingBufferQueue for buffering encoded requests until we have an RntbdRequest
      void channelUnregistered​(io.netty.channel.ChannelHandlerContext context)
      The Channel of the ChannelHandlerContext was unregistered from its EventLoop
      void channelWritabilityChanged​(io.netty.channel.ChannelHandlerContext context)
      Gets called once the writable state of a Channel changed.
      void close​(io.netty.channel.ChannelHandlerContext context, io.netty.channel.ChannelPromise promise)
      Called once a close operation is made.
      void connect​(io.netty.channel.ChannelHandlerContext context, SocketAddress remoteAddress, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)
      Called once a connect operation is made.
      void deregister​(io.netty.channel.ChannelHandlerContext context, io.netty.channel.ChannelPromise promise)
      Called once a deregister operation is made from the current registered EventLoop.
      void disconnect​(io.netty.channel.ChannelHandlerContext context, io.netty.channel.ChannelPromise promise)
      Called once a disconnect operation is made.
      void exceptionCaught​(io.netty.channel.ChannelHandlerContext context, Throwable cause)
      Processes ChannelHandlerContext.fireExceptionCaught(Throwable) in the ChannelPipeline
      void flush​(io.netty.channel.ChannelHandlerContext context)
      Called once a flush operation is made
      void handlerAdded​(io.netty.channel.ChannelHandlerContext context)
      Gets called after the ChannelHandler was added to the actual context and it's ready to handle events.
      void handlerRemoved​(io.netty.channel.ChannelHandlerContext context)
      Gets called after the ChannelHandler was removed from the actual context and it doesn't handle events anymore.
      void read​(io.netty.channel.ChannelHandlerContext context)
      Intercepts ChannelHandlerContext.read()
      void userEventTriggered​(io.netty.channel.ChannelHandlerContext context, Object event)
      Processes inbound events triggered by channel handlers in the RntbdClientChannelHandler pipeline
      void write​(io.netty.channel.ChannelHandlerContext context, Object message, io.netty.channel.ChannelPromise promise)
      Called once a write operation is made
    • Constructor Detail

      • RntbdRequestManager

        public RntbdRequestManager​(io.netty.channel.pool.ChannelHealthChecker healthChecker,
                                   int pendingRequestLimit)
    • Method Detail

      • handlerAdded

        public void handlerAdded​(io.netty.channel.ChannelHandlerContext context)
        Gets called after the ChannelHandler was added to the actual context and it's ready to handle events.
        Specified by:
        handlerAdded in interface io.netty.channel.ChannelHandler
        Parameters:
        context - ChannelHandlerContext to which this RntbdRequestManager belongs
      • handlerRemoved

        public void handlerRemoved​(io.netty.channel.ChannelHandlerContext context)
        Gets called after the ChannelHandler was removed from the actual context and it doesn't handle events anymore.
        Specified by:
        handlerRemoved in interface io.netty.channel.ChannelHandler
        Parameters:
        context - ChannelHandlerContext to which this RntbdRequestManager belongs
      • channelActive

        public void channelActive​(io.netty.channel.ChannelHandlerContext context)
        The Channel of the ChannelHandlerContext is now active
        Specified by:
        channelActive in interface io.netty.channel.ChannelInboundHandler
        Parameters:
        context - ChannelHandlerContext to which this RntbdRequestManager belongs
      • channelInactive

        public void channelInactive​(io.netty.channel.ChannelHandlerContext context)
        The Channel of the ChannelHandlerContext was registered and has reached the end of its lifetime

        This method will only be called after the channel is closed.

        Specified by:
        channelInactive in interface io.netty.channel.ChannelInboundHandler
        Parameters:
        context - ChannelHandlerContext to which this RntbdRequestManager belongs
      • channelRead

        public void channelRead​(io.netty.channel.ChannelHandlerContext context,
                                Object message)
        The Channel of the ChannelHandlerContext has read a message from its peer.
        Specified by:
        channelRead in interface io.netty.channel.ChannelInboundHandler
        Parameters:
        context - ChannelHandlerContext to which this RntbdRequestManager belongs.
        message - The message read.
      • channelReadComplete

        public void channelReadComplete​(io.netty.channel.ChannelHandlerContext context)
        The Channel of the ChannelHandlerContext has fully consumed the most-recent message read.

        If ChannelOption.AUTO_READ is off, no further attempt to read inbound data from the current Channel will be made until ChannelHandlerContext.read() is called. This leaves time for outbound messages to be written.

        Specified by:
        channelReadComplete in interface io.netty.channel.ChannelInboundHandler
        Parameters:
        context - ChannelHandlerContext to which this RntbdRequestManager belongs
      • channelRegistered

        public void channelRegistered​(io.netty.channel.ChannelHandlerContext context)
        Constructs a CoalescingBufferQueue for buffering encoded requests until we have an RntbdRequest

        This method then calls ChannelHandlerContext.fireChannelRegistered() to forward to the next ChannelInboundHandler in the ChannelPipeline.

        Sub-classes may override this method to change behavior.

        Specified by:
        channelRegistered in interface io.netty.channel.ChannelInboundHandler
        Parameters:
        context - the ChannelHandlerContext for which the bind operation is made
      • channelUnregistered

        public void channelUnregistered​(io.netty.channel.ChannelHandlerContext context)
        The Channel of the ChannelHandlerContext was unregistered from its EventLoop
        Specified by:
        channelUnregistered in interface io.netty.channel.ChannelInboundHandler
        Parameters:
        context - ChannelHandlerContext to which this RntbdRequestManager belongs
      • channelWritabilityChanged

        public void channelWritabilityChanged​(io.netty.channel.ChannelHandlerContext context)
        Gets called once the writable state of a Channel changed. You can check the state with Channel.isWritable().
        Specified by:
        channelWritabilityChanged in interface io.netty.channel.ChannelInboundHandler
        Parameters:
        context - ChannelHandlerContext to which this RntbdRequestManager belongs
      • exceptionCaught

        public void exceptionCaught​(io.netty.channel.ChannelHandlerContext context,
                                    Throwable cause)
        Processes ChannelHandlerContext.fireExceptionCaught(Throwable) in the ChannelPipeline
        Specified by:
        exceptionCaught in interface io.netty.channel.ChannelHandler
        Specified by:
        exceptionCaught in interface io.netty.channel.ChannelInboundHandler
        Parameters:
        context - ChannelHandlerContext to which this RntbdRequestManager belongs
        cause - Exception caught
      • userEventTriggered

        public void userEventTriggered​(io.netty.channel.ChannelHandlerContext context,
                                       Object event)
        Processes inbound events triggered by channel handlers in the RntbdClientChannelHandler pipeline

        All but inbound request management events are ignored.

        Specified by:
        userEventTriggered in interface io.netty.channel.ChannelInboundHandler
        Parameters:
        context - ChannelHandlerContext to which this RntbdRequestManager belongs
        event - An object representing a user event
      • bind

        public void bind​(io.netty.channel.ChannelHandlerContext context,
                         SocketAddress localAddress,
                         io.netty.channel.ChannelPromise promise)
        Called once a bind operation is made.
        Specified by:
        bind in interface io.netty.channel.ChannelOutboundHandler
        Parameters:
        context - the ChannelHandlerContext for which the bind operation is made
        localAddress - the SocketAddress to which it should bound
        promise - the ChannelPromise to notify once the operation completes
      • close

        public void close​(io.netty.channel.ChannelHandlerContext context,
                          io.netty.channel.ChannelPromise promise)
        Called once a close operation is made.
        Specified by:
        close in interface io.netty.channel.ChannelOutboundHandler
        Parameters:
        context - the ChannelHandlerContext for which the close operation is made
        promise - the ChannelPromise to notify once the operation completes
      • connect

        public void connect​(io.netty.channel.ChannelHandlerContext context,
                            SocketAddress remoteAddress,
                            SocketAddress localAddress,
                            io.netty.channel.ChannelPromise promise)
        Called once a connect operation is made.
        Specified by:
        connect in interface io.netty.channel.ChannelOutboundHandler
        Parameters:
        context - the ChannelHandlerContext for which the connect operation is made
        remoteAddress - the SocketAddress to which it should connect
        localAddress - the SocketAddress which is used as source on connect
        promise - the ChannelPromise to notify once the operation completes
      • deregister

        public void deregister​(io.netty.channel.ChannelHandlerContext context,
                               io.netty.channel.ChannelPromise promise)
        Called once a deregister operation is made from the current registered EventLoop.
        Specified by:
        deregister in interface io.netty.channel.ChannelOutboundHandler
        Parameters:
        context - the ChannelHandlerContext for which the deregister operation is made
        promise - the ChannelPromise to notify once the operation completes
      • disconnect

        public void disconnect​(io.netty.channel.ChannelHandlerContext context,
                               io.netty.channel.ChannelPromise promise)
        Called once a disconnect operation is made.
        Specified by:
        disconnect in interface io.netty.channel.ChannelOutboundHandler
        Parameters:
        context - the ChannelHandlerContext for which the disconnect operation is made
        promise - the ChannelPromise to notify once the operation completes
      • flush

        public void flush​(io.netty.channel.ChannelHandlerContext context)
        Called once a flush operation is made

        The flush operation will try to flush out all previous written messages that are pending.

        Specified by:
        flush in interface io.netty.channel.ChannelOutboundHandler
        Parameters:
        context - the ChannelHandlerContext for which the flush operation is made
      • read

        public void read​(io.netty.channel.ChannelHandlerContext context)
        Intercepts ChannelHandlerContext.read()
        Specified by:
        read in interface io.netty.channel.ChannelOutboundHandler
        Parameters:
        context - the ChannelHandlerContext for which the read operation is made
      • write

        public void write​(io.netty.channel.ChannelHandlerContext context,
                          Object message,
                          io.netty.channel.ChannelPromise promise)
        Called once a write operation is made

        The write operation will send messages through the ChannelPipeline which are then ready to be flushed to the actual Channel. This will occur when Channel.flush() is called.

        Specified by:
        write in interface io.netty.channel.ChannelOutboundHandler
        Parameters:
        context - the ChannelHandlerContext for which the write operation is made
        message - the message to write
        promise - the ChannelPromise to notify once the operation completes