Package io.grpc.netty
Class AbstractNettyHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.handler.codec.ByteToMessageDecoder
-
- io.netty.handler.codec.http2.Http2ConnectionHandler
-
- io.grpc.netty.GrpcHttp2ConnectionHandler
-
- io.grpc.netty.AbstractNettyHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler,io.netty.handler.codec.http2.Http2LifecycleManager
- Direct Known Subclasses:
NettyClientHandler,NettyServerHandler
abstract class AbstractNettyHandler extends GrpcHttp2ConnectionHandler
Base class for all Netty gRPC handlers. This class standardizes exception handling (always shutdown the connection) as well as sending the initial connection window at startup.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classAbstractNettyHandler.AllowPingLimiter(package private) classAbstractNettyHandler.FlowControlPingerClass for handling flow control pinging and flow control window updates as necessary.static interfaceAbstractNettyHandler.PingLimiterControls whether PINGs like those for BDP are permitted to be sent at the current time.
-
Field Summary
Fields Modifier and Type Field Description private booleanautoTuneFlowControlOnprivate static longBDP_MEASUREMENT_PINGprivate io.netty.channel.ChannelHandlerContextctxprivate AbstractNettyHandler.FlowControlPingerflowControlPingprivate static longGRACEFUL_SHUTDOWN_NO_TIMEOUTprivate intinitialConnectionWindowprivate booleaninitialWindowSentprivate com.google.common.base.Tickerticker-
Fields inherited from class io.grpc.netty.GrpcHttp2ConnectionHandler
ADAPTIVE_CUMULATOR, ADAPTIVE_CUMULATOR_COMPOSE_MIN_SIZE_DEFAULT, channelUnused
-
-
Constructor Summary
Constructors Constructor Description AbstractNettyHandler(io.netty.channel.ChannelPromise channelUnused, io.netty.handler.codec.http2.Http2ConnectionDecoder decoder, io.netty.handler.codec.http2.Http2ConnectionEncoder encoder, io.netty.handler.codec.http2.Http2Settings initialSettings, ChannelLogger negotiationLogger, boolean autoFlowControl, AbstractNettyHandler.PingLimiter pingLimiter, com.google.common.base.Ticker ticker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchannelActive(io.netty.channel.ChannelHandlerContext ctx)protected io.netty.channel.ChannelHandlerContextctx()voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable cause)(package private) AbstractNettyHandler.FlowControlPingerflowControlPing()voidhandlerAdded(io.netty.channel.ChannelHandlerContext ctx)private voidsendInitialConnectionWindow()Sends initial connection window to the remote endpoint if necessary.(package private) voidsetAutoTuneFlowControl(boolean isOn)-
Methods inherited from class io.grpc.netty.GrpcHttp2ConnectionHandler
getAuthority, getEagAttributes, getNegotiationLogger, handleProtocolNegotiationCompleted, handleProtocolNegotiationCompleted, notifyUnused, usingPre4_1_111_Netty
-
Methods inherited from class io.netty.handler.codec.http2.Http2ConnectionHandler
bind, channelInactive, channelReadComplete, channelWritabilityChanged, close, closeStream, closeStreamLocal, closeStreamRemote, connect, connection, decode, decoder, deregister, disconnect, encoder, flush, frameWriter, goAway, gracefulShutdownTimeoutMillis, gracefulShutdownTimeoutMillis, handlerRemoved0, handleServerHeaderDecodeSizeError, isGracefulShutdownComplete, onConnectionError, onError, onHttpClientUpgrade, onHttpServerUpgrade, onStreamError, read, resetStream, write
-
Methods inherited from class io.netty.handler.codec.ByteToMessageDecoder
actualReadableBytes, callDecode, channelRead, decodeLast, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelRegistered, channelUnregistered
-
-
-
-
Field Detail
-
GRACEFUL_SHUTDOWN_NO_TIMEOUT
private static final long GRACEFUL_SHUTDOWN_NO_TIMEOUT
- See Also:
- Constant Field Values
-
initialConnectionWindow
private final int initialConnectionWindow
-
flowControlPing
private final AbstractNettyHandler.FlowControlPinger flowControlPing
-
autoTuneFlowControlOn
private boolean autoTuneFlowControlOn
-
ctx
private io.netty.channel.ChannelHandlerContext ctx
-
initialWindowSent
private boolean initialWindowSent
-
ticker
private final com.google.common.base.Ticker ticker
-
BDP_MEASUREMENT_PING
private static final long BDP_MEASUREMENT_PING
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractNettyHandler
AbstractNettyHandler(io.netty.channel.ChannelPromise channelUnused, io.netty.handler.codec.http2.Http2ConnectionDecoder decoder, io.netty.handler.codec.http2.Http2ConnectionEncoder encoder, io.netty.handler.codec.http2.Http2Settings initialSettings, ChannelLogger negotiationLogger, boolean autoFlowControl, AbstractNettyHandler.PingLimiter pingLimiter, com.google.common.base.Ticker ticker)
-
-
Method Detail
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) throws java.lang.Exception- Specified by:
handlerAddedin interfaceio.netty.channel.ChannelHandler- Overrides:
handlerAddedin classio.netty.handler.codec.http2.Http2ConnectionHandler- Throws:
java.lang.Exception
-
channelActive
public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws java.lang.Exception- Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classio.netty.handler.codec.http2.Http2ConnectionHandler- Throws:
java.lang.Exception
-
exceptionCaught
public final void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable cause) throws java.lang.Exception- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.handler.codec.http2.Http2ConnectionHandler- Throws:
java.lang.Exception
-
ctx
protected final io.netty.channel.ChannelHandlerContext ctx()
-
sendInitialConnectionWindow
private void sendInitialConnectionWindow() throws io.netty.handler.codec.http2.Http2ExceptionSends initial connection window to the remote endpoint if necessary.- Throws:
io.netty.handler.codec.http2.Http2Exception
-
flowControlPing
AbstractNettyHandler.FlowControlPinger flowControlPing()
-
setAutoTuneFlowControl
void setAutoTuneFlowControl(boolean isOn)
-
-