@UnstableApi public class Http2MultiplexCodec extends Http2FrameCodec
When a new stream is created, a new Channel 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.
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
http://netty.io/wiki/reference-counted-objects.html
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.ByteToMessageDecoder.CumulatorChannelHandler.SharableCOMPOSITE_CUMULATOR, MERGE_CUMULATOR| Modifier and Type | Method and Description |
|---|---|
void |
channelReadComplete(ChannelHandlerContext ctx)
Notifies any child streams of the read completion.
|
void |
flush(ChannelHandlerContext ctx)
Called once a flush operation is made.
|
void |
handlerAdded0(ChannelHandlerContext ctx) |
void |
handlerRemoved0(ChannelHandlerContext ctx)
Gets called after the
ByteToMessageDecoder was removed from the actual context and it doesn't handle
events anymore. |
handlerAdded, isGracefulShutdownComplete, onConnectionError, onStreamError, userEventTriggered, writebind, channelActive, channelInactive, channelWritabilityChanged, close, closeStream, closeStreamLocal, closeStreamRemote, connect, connection, decode, decoder, deregister, disconnect, encoder, exceptionCaught, frameWriter, goAway, gracefulShutdownTimeoutMillis, gracefulShutdownTimeoutMillis, handleServerHeaderDecodeSizeError, onError, onHttpClientUpgrade, onHttpServerUpgrade, read, resetStreamactualReadableBytes, callDecode, channelRead, decodeLast, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecodechannelRegistered, channelUnregisteredensureNotSharable, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlerRemovedpublic final void handlerAdded0(ChannelHandlerContext ctx) throws Exception
Exceptionpublic final void handlerRemoved0(ChannelHandlerContext ctx) throws Exception
ByteToMessageDecoderByteToMessageDecoder was removed from the actual context and it doesn't handle
events anymore.handlerRemoved0 in class Http2ConnectionHandlerExceptionpublic final void channelReadComplete(ChannelHandlerContext ctx) throws Exception
channelReadComplete in interface ChannelInboundHandlerchannelReadComplete in class Http2ConnectionHandlerExceptionpublic final void flush(ChannelHandlerContext ctx)
ChannelOutboundHandlerflush in interface ChannelOutboundHandlerflush in class Http2ConnectionHandlerctx - the ChannelHandlerContext for which the flush operation is madeCopyright © 2008–2017 The Netty Project. All rights reserved.