@UnstableApi
public class Http2ConnectionHandler
extends io.netty.handler.codec.ByteToMessageDecoder
implements io.netty.handler.codec.http2.Http2LifecycleManager, io.netty.channel.ChannelOutboundHandler
Http2FrameListener
This class will read HTTP/2 frames and delegate the events to a Http2FrameListener
This interface enforces inbound flow control functionality through Http2LocalFlowController
| 限定符和类型 | 字段和说明 |
|---|---|
static io.prometheus.client.Histogram |
flushCtxFlushDuration |
static io.prometheus.client.Histogram |
flushFlowControlWriteDuration |
| 限定符 | 构造器和说明 |
|---|---|
protected |
Http2ConnectionHandler(io.netty.handler.codec.http2.Http2ConnectionDecoder decoder,
io.netty.handler.codec.http2.Http2ConnectionEncoder encoder,
io.netty.handler.codec.http2.Http2Settings initialSettings) |
protected |
Http2ConnectionHandler(io.netty.handler.codec.http2.Http2ConnectionDecoder decoder,
io.netty.handler.codec.http2.Http2ConnectionEncoder encoder,
io.netty.handler.codec.http2.Http2Settings initialSettings,
boolean decoupleCloseAndGoAway) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
bind(io.netty.channel.ChannelHandlerContext ctx,
SocketAddress localAddress,
io.netty.channel.ChannelPromise promise) |
void |
channelActive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelInactive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelReadComplete(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) |
void |
close(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.ChannelPromise promise) |
void |
closeStream(io.netty.handler.codec.http2.Http2Stream stream,
io.netty.channel.ChannelFuture future) |
void |
closeStreamLocal(io.netty.handler.codec.http2.Http2Stream stream,
io.netty.channel.ChannelFuture future)
Closes the local side of the given stream.
|
void |
closeStreamRemote(io.netty.handler.codec.http2.Http2Stream stream,
io.netty.channel.ChannelFuture future)
Closes the remote side of the given stream.
|
void |
connect(io.netty.channel.ChannelHandlerContext ctx,
SocketAddress remoteAddress,
SocketAddress localAddress,
io.netty.channel.ChannelPromise promise) |
io.netty.handler.codec.http2.Http2Connection |
connection() |
protected void |
decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf in,
List<Object> out) |
io.netty.handler.codec.http2.Http2ConnectionDecoder |
decoder() |
void |
deregister(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.ChannelPromise promise) |
void |
disconnect(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.ChannelPromise promise) |
io.netty.handler.codec.http2.Http2ConnectionEncoder |
encoder() |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
Handles
Http2Exception objects that were thrown from other handlers. |
void |
flush(io.netty.channel.ChannelHandlerContext ctx) |
protected io.netty.handler.codec.http2.Http2FrameWriter |
frameWriter() |
io.netty.channel.ChannelFuture |
goAway(io.netty.channel.ChannelHandlerContext ctx,
int lastStreamId,
long errorCode,
io.netty.buffer.ByteBuf debugData,
io.netty.channel.ChannelPromise promise) |
long |
gracefulShutdownTimeoutMillis()
Get the amount of time (in milliseconds) this endpoint will wait for all streams to be closed
before closing the connection during the graceful shutdown process.
|
void |
gracefulShutdownTimeoutMillis(long gracefulShutdownTimeoutMillis)
Set the amount of time (in milliseconds) this endpoint will wait for all streams to be closed
before closing the connection during the graceful shutdown process.
|
void |
handlerAdded(io.netty.channel.ChannelHandlerContext ctx) |
protected void |
handlerRemoved0(io.netty.channel.ChannelHandlerContext ctx) |
protected void |
handleServerHeaderDecodeSizeError(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http2.Http2Stream stream)
Notifies client that this server has received headers that are larger than what it is willing
to accept.
|
protected boolean |
isGracefulShutdownComplete()
Called by the graceful shutdown logic to determine when it is safe to close the connection.
|
protected void |
onConnectionError(io.netty.channel.ChannelHandlerContext ctx,
boolean outbound,
Throwable cause,
io.netty.handler.codec.http2.Http2Exception http2Ex)
Handler for a connection error.
|
void |
onError(io.netty.channel.ChannelHandlerContext ctx,
boolean outbound,
Throwable cause)
Central handler for all exceptions caught during HTTP/2 processing.
|
void |
onHttpClientUpgrade()
Handles the client-side (cleartext) upgrade from HTTP to HTTP/2.
|
void |
onHttpServerUpgrade(io.netty.handler.codec.http2.Http2Settings settings)
Handles the server-side (cleartext) upgrade from HTTP to HTTP/2.
|
protected void |
onStreamError(io.netty.channel.ChannelHandlerContext ctx,
boolean outbound,
Throwable cause,
io.netty.handler.codec.http2.Http2Exception.StreamException http2Ex)
Handler for a stream error.
|
void |
read(io.netty.channel.ChannelHandlerContext ctx) |
io.netty.channel.ChannelFuture |
resetStream(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
long errorCode,
io.netty.channel.ChannelPromise promise) |
void |
write(io.netty.channel.ChannelHandlerContext ctx,
Object msg,
io.netty.channel.ChannelPromise promise) |
actualReadableBytes, callDecode, channelRead, decodeLast, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggeredpublic static final io.prometheus.client.Histogram flushFlowControlWriteDuration
public static final io.prometheus.client.Histogram flushCtxFlushDuration
protected Http2ConnectionHandler(io.netty.handler.codec.http2.Http2ConnectionDecoder decoder,
io.netty.handler.codec.http2.Http2ConnectionEncoder encoder,
io.netty.handler.codec.http2.Http2Settings initialSettings)
protected Http2ConnectionHandler(io.netty.handler.codec.http2.Http2ConnectionDecoder decoder,
io.netty.handler.codec.http2.Http2ConnectionEncoder encoder,
io.netty.handler.codec.http2.Http2Settings initialSettings,
boolean decoupleCloseAndGoAway)
public long gracefulShutdownTimeoutMillis()
public void gracefulShutdownTimeoutMillis(long gracefulShutdownTimeoutMillis)
gracefulShutdownTimeoutMillis - the amount of time (in milliseconds) this endpoint will
wait for all streams to be closed before closing the connection during the graceful
shutdown process.public io.netty.handler.codec.http2.Http2Connection connection()
public io.netty.handler.codec.http2.Http2ConnectionDecoder decoder()
public io.netty.handler.codec.http2.Http2ConnectionEncoder encoder()
public void onHttpClientUpgrade()
throws io.netty.handler.codec.http2.Http2Exception
io.netty.handler.codec.http2.Http2Exceptionpublic void onHttpServerUpgrade(io.netty.handler.codec.http2.Http2Settings settings)
throws io.netty.handler.codec.http2.Http2Exception
settings - the settings for the remote endpoint.io.netty.handler.codec.http2.Http2Exceptionpublic void flush(io.netty.channel.ChannelHandlerContext ctx)
flush 在接口中 io.netty.channel.ChannelOutboundHandlerpublic void handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
handlerAdded 在接口中 io.netty.channel.ChannelHandlerhandlerAdded 在类中 io.netty.channel.ChannelHandlerAdapterExceptionprotected void handlerRemoved0(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
handlerRemoved0 在类中 io.netty.handler.codec.ByteToMessageDecoderExceptionpublic void channelActive(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelActive 在接口中 io.netty.channel.ChannelInboundHandlerchannelActive 在类中 io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelInactive 在接口中 io.netty.channel.ChannelInboundHandlerchannelInactive 在类中 io.netty.handler.codec.ByteToMessageDecoderExceptionpublic void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelWritabilityChanged 在接口中 io.netty.channel.ChannelInboundHandlerchannelWritabilityChanged 在类中 io.netty.channel.ChannelInboundHandlerAdapterExceptionprotected void decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf in,
List<Object> out)
throws Exception
decode 在类中 io.netty.handler.codec.ByteToMessageDecoderExceptionpublic void bind(io.netty.channel.ChannelHandlerContext ctx,
SocketAddress localAddress,
io.netty.channel.ChannelPromise promise)
throws Exception
bind 在接口中 io.netty.channel.ChannelOutboundHandlerExceptionpublic void connect(io.netty.channel.ChannelHandlerContext ctx,
SocketAddress remoteAddress,
SocketAddress localAddress,
io.netty.channel.ChannelPromise promise)
throws Exception
connect 在接口中 io.netty.channel.ChannelOutboundHandlerExceptionpublic void disconnect(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.ChannelPromise promise)
throws Exception
disconnect 在接口中 io.netty.channel.ChannelOutboundHandlerExceptionpublic void close(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.ChannelPromise promise)
throws Exception
close 在接口中 io.netty.channel.ChannelOutboundHandlerExceptionpublic void deregister(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.ChannelPromise promise)
throws Exception
deregister 在接口中 io.netty.channel.ChannelOutboundHandlerExceptionpublic void read(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
read 在接口中 io.netty.channel.ChannelOutboundHandlerExceptionpublic void write(io.netty.channel.ChannelHandlerContext ctx,
Object msg,
io.netty.channel.ChannelPromise promise)
throws Exception
write 在接口中 io.netty.channel.ChannelOutboundHandlerExceptionpublic void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelReadComplete 在接口中 io.netty.channel.ChannelInboundHandlerchannelReadComplete 在类中 io.netty.handler.codec.ByteToMessageDecoderExceptionpublic void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
throws Exception
Http2Exception objects that were thrown from other handlers. Ignores all other
exceptions.exceptionCaught 在接口中 io.netty.channel.ChannelHandlerexceptionCaught 在接口中 io.netty.channel.ChannelInboundHandlerexceptionCaught 在类中 io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void closeStreamLocal(io.netty.handler.codec.http2.Http2Stream stream,
io.netty.channel.ChannelFuture future)
closeStreamLocal 在接口中 io.netty.handler.codec.http2.Http2LifecycleManagerstream - the stream to be half closed.future - If closing, the future after which to close the channel.public void closeStreamRemote(io.netty.handler.codec.http2.Http2Stream stream,
io.netty.channel.ChannelFuture future)
closeStreamRemote 在接口中 io.netty.handler.codec.http2.Http2LifecycleManagerstream - the stream to be half closed.future - If closing, the future after which to close the channel.public void closeStream(io.netty.handler.codec.http2.Http2Stream stream,
io.netty.channel.ChannelFuture future)
closeStream 在接口中 io.netty.handler.codec.http2.Http2LifecycleManagerpublic void onError(io.netty.channel.ChannelHandlerContext ctx,
boolean outbound,
Throwable cause)
onError 在接口中 io.netty.handler.codec.http2.Http2LifecycleManagerprotected boolean isGracefulShutdownComplete()
true if the graceful shutdown has completed and the connection can be safely
closed. This implementation just guarantees that there are no active streams. Subclasses may
override to provide additional checks.protected void onConnectionError(io.netty.channel.ChannelHandlerContext ctx,
boolean outbound,
Throwable cause,
io.netty.handler.codec.http2.Http2Exception http2Ex)
ctx - the channel contextoutbound - true if the error was caused by an outbound operation.cause - the exception that was caughthttp2Ex - the Http2Exception that is embedded in the causality chain. This may be
null if it's an unknown exception.protected void onStreamError(io.netty.channel.ChannelHandlerContext ctx,
boolean outbound,
Throwable cause,
io.netty.handler.codec.http2.Http2Exception.StreamException http2Ex)
RST_STREAM frame to the remote endpoint and closes
the stream.ctx - the channel contextoutbound - true if the error was caused by an outbound operation.cause - the exception that was caughthttp2Ex - the Http2Exception.StreamException that is embedded in the causality chain.protected void handleServerHeaderDecodeSizeError(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http2.Http2Stream stream)
ctx - the channel contextstream - the Http2Stream on which the header was receivedprotected io.netty.handler.codec.http2.Http2FrameWriter frameWriter()
public io.netty.channel.ChannelFuture resetStream(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
long errorCode,
io.netty.channel.ChannelPromise promise)
resetStream 在接口中 io.netty.handler.codec.http2.Http2LifecycleManagerpublic io.netty.channel.ChannelFuture goAway(io.netty.channel.ChannelHandlerContext ctx,
int lastStreamId,
long errorCode,
io.netty.buffer.ByteBuf debugData,
io.netty.channel.ChannelPromise promise)
goAway 在接口中 io.netty.handler.codec.http2.Http2LifecycleManagerCopyright © 2023 PingCAP. All rights reserved.