Package org.apache.hadoop.hbase.ipc
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().
- 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
Modifier and TypeFieldDescriptionprivate final BooleanSupplier
private final MetricsHBaseServer
(package private) static final String
private final IntSupplier
private long
private boolean
-
Constructor Summary
ConstructorDescriptionNettyRpcServerChannelWritabilityHandler
(MetricsHBaseServer metrics, IntSupplier pendingBytesFatalThreshold, BooleanSupplier isWritabilityBackpressureEnabled) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
-
Field Details
-
NAME
- See Also:
-
metrics
-
pendingBytesFatalThreshold
-
isWritabilityBackpressureEnabled
-
writable
-
unwritableStartTime
-
-
Constructor Details
-
NettyRpcServerChannelWritabilityHandler
NettyRpcServerChannelWritabilityHandler(MetricsHBaseServer metrics, IntSupplier pendingBytesFatalThreshold, BooleanSupplier isWritabilityBackpressureEnabled)
-
-
Method Details
-
write
public void write(org.apache.hbase.thirdparty.io.netty.channel.ChannelHandlerContext ctx, Object msg, org.apache.hbase.thirdparty.io.netty.channel.ChannelPromise promise) throws Exception - Specified by:
write
in interfaceorg.apache.hbase.thirdparty.io.netty.channel.ChannelOutboundHandler
- Overrides:
write
in classorg.apache.hbase.thirdparty.io.netty.channel.ChannelDuplexHandler
- Throws:
Exception
-
channelWritabilityChanged
public void channelWritabilityChanged(org.apache.hbase.thirdparty.io.netty.channel.ChannelHandlerContext ctx) throws Exception - Specified by:
channelWritabilityChanged
in interfaceorg.apache.hbase.thirdparty.io.netty.channel.ChannelInboundHandler
- Overrides:
channelWritabilityChanged
in classorg.apache.hbase.thirdparty.io.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
handleFatalThreshold
private boolean handleFatalThreshold(org.apache.hbase.thirdparty.io.netty.channel.ChannelHandlerContext ctx) -
handleWritabilityChanged
private void handleWritabilityChanged(org.apache.hbase.thirdparty.io.netty.channel.ChannelHandlerContext ctx)
-