Class NettyRpcServerChannelWritabilityHandler

java.lang.Object
org.apache.hbase.thirdparty.io.netty.channel.ChannelHandlerAdapter
org.apache.hbase.thirdparty.io.netty.channel.ChannelInboundHandlerAdapter
org.apache.hbase.thirdparty.io.netty.channel.ChannelDuplexHandler
org.apache.hadoop.hbase.ipc.NettyRpcServerChannelWritabilityHandler
All Implemented Interfaces:
org.apache.hbase.thirdparty.io.netty.channel.ChannelHandler, org.apache.hbase.thirdparty.io.netty.channel.ChannelInboundHandler, org.apache.hbase.thirdparty.io.netty.channel.ChannelOutboundHandler

@Private public class NettyRpcServerChannelWritabilityHandler extends org.apache.hbase.thirdparty.io.netty.channel.ChannelDuplexHandler
Handler to enforce writability protections on our server channels:
- Responds to channel writability events, which are triggered when the total pending bytes for a channel passes configured high and low watermarks. When high watermark is exceeded, the channel is setAutoRead(false). This way, we won't accept new requests from the client until some pending outbound bytes are successfully received by the client.
- Pre-processes any channel write requests. If the total pending outbound bytes exceeds a fatal threshold, the channel is forcefully closed and the write is set to failed. This handler should be the last handler in the pipeline so that it's the first handler to receive any messages sent to channel.write() or channel.writeAndFlush().
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.hbase.thirdparty.io.netty.channel.ChannelHandler

    org.apache.hbase.thirdparty.io.netty.channel.ChannelHandler.Sharable
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final BooleanSupplier
     
    private final MetricsHBaseServer
     
    (package private) static final String
     
    private final IntSupplier
     
    private long
     
    private boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    NettyRpcServerChannelWritabilityHandler(MetricsHBaseServer metrics, IntSupplier pendingBytesFatalThreshold, BooleanSupplier isWritabilityBackpressureEnabled)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    channelWritabilityChanged(org.apache.hbase.thirdparty.io.netty.channel.ChannelHandlerContext ctx)
     
    private boolean
    handleFatalThreshold(org.apache.hbase.thirdparty.io.netty.channel.ChannelHandlerContext ctx)
     
    private void
    handleWritabilityChanged(org.apache.hbase.thirdparty.io.netty.channel.ChannelHandlerContext ctx)
     
    void
    write(org.apache.hbase.thirdparty.io.netty.channel.ChannelHandlerContext ctx, Object msg, org.apache.hbase.thirdparty.io.netty.channel.ChannelPromise promise)
     

    Methods inherited from class org.apache.hbase.thirdparty.io.netty.channel.ChannelDuplexHandler

    bind, close, connect, deregister, disconnect, flush, read

    Methods inherited from class org.apache.hbase.thirdparty.io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, exceptionCaught, userEventTriggered

    Methods inherited from class org.apache.hbase.thirdparty.io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.hbase.thirdparty.io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved