Http2FrameCodec.
When a new stream is created, a new Http2StreamChannel is created for it. Applications send and
receive Http2StreamFrames on the created channel. ByteBufs cannot be processed by the channel;
all writes that reach the head of the pipeline must be an instance of Http2StreamFrame. Writes that reach
the head of the pipeline are processed directly by this handler and cannot be intercepted.
The child channel will be notified of user events that impact the stream, such as Http2GoAwayFrame and Http2ResetFrame, as soon as they occur. Although Http2GoAwayFrame and Http2ResetFrame signify that the remote is ignoring further
communication, closing of the channel is delayed until any inbound queue is drained with Channel#read(), which follows the default behavior of channels in Netty. Applications are
free to close the channel in response to such events if they don't have use for any queued
messages. Any connection level events like Http2SettingsFrame and Http2GoAwayFrame
will be processed internally and also propagated down the pipeline for other handlers to act on.
Outbound streams are supported via the Http2StreamChannelBootstrap.
ChannelConfig#setMaxMessagesPerRead(int) and ChannelConfig#setAutoRead(boolean) are supported.
Http2StreamFrames implement the ReferenceCounted interface, as they carry
reference counted objects (e.g. ByteBufs). The multiplex codec will call ReferenceCounted#retain()
before propagating a reference counted object through the pipeline, and thus an application handler needs to release
such an object after having consumed it. For more information on reference counting take a look at
the reference counted docs.
EventLoop. Therefore, an active channel
does not map to an active HTTP/2 stream immediately. Only once a Http2HeadersFrame has been successfully sent
or received, does the channel map to an active HTTP/2 stream. In case it is not possible to open a new HTTP/2 stream
(i.e. due to the maximum number of active streams being exceeded), the child channel receives an exception
indicating the cause and is closed immediately thereafter.
ChannelHandlers are free to ignore the channel's writability, in which case the excessive writes will
be buffered by the parent channel. It's important to note that only Http2DataFrames are subject to
HTTP/2 flow control.
Http2StreamChannelHttp2StreamChannel a Http2ResetFrame will be sent to the remote peer with
Http2Error#CANCEL if needed. If you want to close the stream with another Http2Error (due
errors / limits) you should propagate a Http2FrameStreamException through the ChannelPipeline.
Once it reaches the end of the ChannelPipeline it will automatically close the Http2StreamChannel
and send a Http2ResetFrame with the unwrapped Http2Error set. Another possibility is to just
directly write a Http2ResetFrame to the Http2StreamChannell.
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final ChannelFutureListener | |
| private volatile ChannelHandlerContext | |
| private int | |
| private final ChannelHandler | |
| private boolean | |
| private final Queue | |
| private final ChannelHandler |
| Access | Constructor and Description |
|---|---|
| public | Http2MultiplexHandler(ChannelHandler
the inboundStreamHandler)ChannelHandler that will be added to the ChannelPipeline of
the Channels created for new inbound streams.Creates a new instance |
| public | Http2MultiplexHandler(ChannelHandler
the inboundStreamHandler, ChannelHandler upgradeStreamHandler)ChannelHandler that will be added to the ChannelPipeline of
the Channels created for new inbound streams.Creates a new instance |
| CHILD_CHANNEL_REGISTRATION_LISTENER | back to summary |
|---|---|
| pack-priv static final ChannelFutureListener CHILD_CHANNEL_REGISTRATION_LISTENER | |
| ctx | back to summary |
|---|---|
| private volatile ChannelHandlerContext ctx | |
| idCount | back to summary |
|---|---|
| private int idCount | |
| inboundStreamHandler | back to summary |
|---|---|
| private final ChannelHandler inboundStreamHandler | |
| parentReadInProgress | back to summary |
|---|---|
| private boolean parentReadInProgress | |
| readCompletePendingQueue | back to summary |
|---|---|
| private final Queue<AbstractHttp2StreamChannel> readCompletePendingQueue | |
| upgradeStreamHandler | back to summary |
|---|---|
| private final ChannelHandler upgradeStreamHandler | |
| Http2MultiplexHandler | back to summary |
|---|---|
| public Http2MultiplexHandler(ChannelHandler inboundStreamHandler) Creates a new instance
| |
| Http2MultiplexHandler | back to summary |
|---|---|
| public Http2MultiplexHandler(ChannelHandler inboundStreamHandler, ChannelHandler upgradeStreamHandler) Creates a new instance
| |
| channelRead | back to summary |
|---|---|
| public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception Overrides io. Implements io. Doc from io. Calls
| |
| channelReadComplete | back to summary |
|---|---|
| public void channelReadComplete(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Notifies any child streams of the read completion.
| |
| channelWritabilityChanged | back to summary |
|---|---|
| public void channelWritabilityChanged(final ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Calls
| |
| exceptionCaught | back to summary |
|---|---|
| public void exceptionCaught(ChannelHandlerContext ctx, final Throwable cause) throws Exception Overrides io. Implements io. Doc from io. Gets called if a
| |
| fireExceptionCaughtForActiveStream | back to summary |
|---|---|
| private void fireExceptionCaughtForActiveStream(final Throwable cause) throws Http2Exception | |
| handlerAdded0 | back to summary |
|---|---|
| protected void handlerAdded0(ChannelHandlerContext ctx) Overrides io.
| |
| handlerRemoved0 | back to summary |
|---|---|
| protected void handlerRemoved0(ChannelHandlerContext ctx) Overrides io.
| |
| isServer | back to summary |
|---|---|
| private static boolean isServer(ChannelHandlerContext ctx) | |
| newOutboundStream | back to summary |
|---|---|
| pack-priv Http2StreamChannel newOutboundStream() | |
| onHttp2GoAwayFrame | back to summary |
|---|---|
| private void onHttp2GoAwayFrame(ChannelHandlerContext ctx, final Http2GoAwayFrame goAwayFrame) | |
| processPendingReadCompleteQueue | back to summary |
|---|---|
| private void processPendingReadCompleteQueue() | |
| registerDone | back to summary |
|---|---|
| pack-priv static void registerDone(ChannelFuture future) | |
| userEventTriggered | back to summary |
|---|---|
| public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception Overrides io. Implements io. Doc from io. Calls
| |
| Access | Constructor and Description |
|---|---|
| pack-priv | Http2MultiplexHandlerStreamChannel(Http2FrameCodec.
|
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected boolean | |
| protected ChannelHandlerContext | parentContext()
Implements abstract io. |
| Http2MultiplexHandlerStreamChannel | back to summary |
|---|---|
| pack-priv Http2MultiplexHandlerStreamChannel(Http2FrameCodec. | |
| addChannelToReadCompletePendingQueue | back to summary |
|---|---|
| protected void addChannelToReadCompletePendingQueue() Implements abstract io.
| |
| isParentReadInProgress | back to summary |
|---|---|
| protected boolean isParentReadInProgress() Implements abstract io.
| |
| parentContext | back to summary |
|---|---|
| protected ChannelHandlerContext parentContext() Implements abstract io.
| |