Class Http2MultiplexCodec
- java.lang.Object
-
- All Implemented Interfaces:
ChannelHandler
,ChannelInboundHandler
,ChannelOutboundHandler
,Http2LifecycleManager
@Deprecated public class Http2MultiplexCodec extends Http2FrameCodec
Deprecated.useHttp2FrameCodecBuilder
together withHttp2MultiplexHandler
.An HTTP/2 handler that creates child channels for each stream.When a new stream is created, a new
Channel
is created for it. Applications send and receiveHttp2StreamFrame
s on the created channel.ByteBuf
s cannot be processed by the channel; all writes that reach the head of the pipeline must be an instance ofHttp2StreamFrame
. 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
andHttp2ResetFrame
, as soon as they occur. AlthoughHttp2GoAwayFrame
andHttp2ResetFrame
signify that the remote is ignoring further communication, closing of the channel is delayed until any inbound queue is drained withChannel.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 likeHttp2SettingsFrame
andHttp2GoAwayFrame
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)
andChannelConfig.setAutoRead(boolean)
are supported.Reference Counting
SomeHttp2StreamFrame
s implement theReferenceCounted
interface, as they carry reference counted objects (e.g.ByteBuf
s). The multiplex codec will callReferenceCounted.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 https://netty.io/wiki/reference-counted-objects.htmlChannel Events
A child channel becomes active as soon as it is registered to anEventLoop
. Therefore, an active channel does not map to an active HTTP/2 stream immediately. Only once aHttp2HeadersFrame
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.Writability and Flow Control
A child channel observes outbound/remote flow control via the channel's writability. A channel only becomes writable when it maps to an active HTTP/2 stream and the stream's flow control window is greater than zero. A child channel does not know about the connection-level flow control window.ChannelHandler
s 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 onlyHttp2DataFrame
s are subject to HTTP/2 flow control.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
Http2MultiplexCodec.Http2MultiplexCodecStreamChannel
Deprecated.-
Nested classes/interfaces inherited from class io.netty.handler.codec.http2.Http2FrameCodec
Http2FrameCodec.DefaultHttp2FrameStream
-
Nested classes/interfaces inherited from class io.netty.handler.codec.ByteToMessageDecoder
ByteToMessageDecoder.Cumulator
-
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ChannelHandlerContext
ctx
Deprecated.private int
idCount
Deprecated.private ChannelHandler
inboundStreamHandler
Deprecated.private boolean
parentReadInProgress
Deprecated.private java.util.Queue<AbstractHttp2StreamChannel>
readCompletePendingQueue
Deprecated.private ChannelHandler
upgradeStreamHandler
Deprecated.-
Fields inherited from class io.netty.handler.codec.http2.Http2FrameCodec
streamKey
-
Fields inherited from class io.netty.handler.codec.ByteToMessageDecoder
COMPOSITE_CUMULATOR, MERGE_CUMULATOR
-
-
Constructor Summary
Constructors Constructor Description Http2MultiplexCodec(Http2ConnectionEncoder encoder, Http2ConnectionDecoder decoder, Http2Settings initialSettings, ChannelHandler inboundStreamHandler, ChannelHandler upgradeStreamHandler, boolean decoupleCloseAndGoAway, boolean flushPreface)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
channelRead(ChannelHandlerContext ctx, java.lang.Object msg)
Deprecated.CallsChannelHandlerContext.fireChannelRead(Object)
to forward to the nextChannelInboundHandler
in theChannelPipeline
.void
channelReadComplete(ChannelHandlerContext ctx)
Deprecated.Notifies any child streams of the read completion.void
channelWritabilityChanged(ChannelHandlerContext ctx)
Deprecated.CallsChannelHandlerContext.fireChannelWritabilityChanged()
to forward to the nextChannelInboundHandler
in theChannelPipeline
.(package private) void
flush0(ChannelHandlerContext ctx)
Deprecated.void
handlerAdded0(ChannelHandlerContext ctx)
Deprecated.void
handlerRemoved0(ChannelHandlerContext ctx)
Deprecated.Gets called after theByteToMessageDecoder
was removed from the actual context and it doesn't handle events anymore.(package private) Http2StreamChannel
newOutboundStream()
Deprecated.(package private) void
onHttp2Frame(ChannelHandlerContext ctx, Http2Frame frame)
Deprecated.(package private) void
onHttp2FrameStreamException(ChannelHandlerContext ctx, Http2FrameStreamException cause)
Deprecated.private void
onHttp2GoAwayFrame(ChannelHandlerContext ctx, Http2GoAwayFrame goAwayFrame)
Deprecated.(package private) void
onHttp2StreamStateChanged(ChannelHandlerContext ctx, Http2FrameCodec.DefaultHttp2FrameStream stream)
Deprecated.void
onHttpClientUpgrade()
Deprecated.Handles the client-side (cleartext) upgrade from HTTP to HTTP/2.(package private) void
onUserEventTriggered(ChannelHandlerContext ctx, java.lang.Object evt)
Deprecated.private void
processPendingReadCompleteQueue()
Deprecated.-
Methods inherited from class io.netty.handler.codec.http2.Http2FrameCodec
consumeBytes, forEachActiveStream, handlerAdded, isGracefulShutdownComplete, newStream, numInitializingStreams, onConnectionError, onStreamError, userEventTriggered, write
-
Methods inherited from class io.netty.handler.codec.http2.Http2ConnectionHandler
bind, channelActive, channelInactive, channelReadComplete0, close, closeStream, closeStreamLocal, closeStreamRemote, connect, connection, decode, decoder, deregister, disconnect, encoder, exceptionCaught, flush, frameWriter, goAway, gracefulShutdownTimeoutMillis, gracefulShutdownTimeoutMillis, handleServerHeaderDecodeSizeError, onError, onHttpServerUpgrade, read, resetStream
-
Methods inherited from class io.netty.handler.codec.ByteToMessageDecoder
actualReadableBytes, callDecode, decodeLast, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelRegistered, channelUnregistered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, isSharable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.channel.ChannelHandler
handlerRemoved
-
-
-
-
Field Detail
-
inboundStreamHandler
private final ChannelHandler inboundStreamHandler
Deprecated.
-
upgradeStreamHandler
private final ChannelHandler upgradeStreamHandler
Deprecated.
-
readCompletePendingQueue
private final java.util.Queue<AbstractHttp2StreamChannel> readCompletePendingQueue
Deprecated.
-
parentReadInProgress
private boolean parentReadInProgress
Deprecated.
-
idCount
private int idCount
Deprecated.
-
ctx
volatile ChannelHandlerContext ctx
Deprecated.
-
-
Constructor Detail
-
Http2MultiplexCodec
Http2MultiplexCodec(Http2ConnectionEncoder encoder, Http2ConnectionDecoder decoder, Http2Settings initialSettings, ChannelHandler inboundStreamHandler, ChannelHandler upgradeStreamHandler, boolean decoupleCloseAndGoAway, boolean flushPreface)
Deprecated.
-
-
Method Detail
-
onHttpClientUpgrade
public void onHttpClientUpgrade() throws Http2Exception
Deprecated.Description copied from class:Http2ConnectionHandler
Handles the client-side (cleartext) upgrade from HTTP to HTTP/2. Reserves local stream 1 for the HTTP/2 response.- Overrides:
onHttpClientUpgrade
in classHttp2ConnectionHandler
- Throws:
Http2Exception
-
handlerAdded0
public final void handlerAdded0(ChannelHandlerContext ctx) throws java.lang.Exception
Deprecated.- Overrides:
handlerAdded0
in classHttp2FrameCodec
- Throws:
java.lang.Exception
-
handlerRemoved0
public final void handlerRemoved0(ChannelHandlerContext ctx) throws java.lang.Exception
Deprecated.Description copied from class:ByteToMessageDecoder
Gets called after theByteToMessageDecoder
was removed from the actual context and it doesn't handle events anymore.- Overrides:
handlerRemoved0
in classHttp2ConnectionHandler
- Throws:
java.lang.Exception
-
onHttp2Frame
final void onHttp2Frame(ChannelHandlerContext ctx, Http2Frame frame)
Deprecated.- Overrides:
onHttp2Frame
in classHttp2FrameCodec
-
onHttp2StreamStateChanged
final void onHttp2StreamStateChanged(ChannelHandlerContext ctx, Http2FrameCodec.DefaultHttp2FrameStream stream)
Deprecated.- Overrides:
onHttp2StreamStateChanged
in classHttp2FrameCodec
-
newOutboundStream
final Http2StreamChannel newOutboundStream()
Deprecated.
-
onHttp2FrameStreamException
final void onHttp2FrameStreamException(ChannelHandlerContext ctx, Http2FrameStreamException cause)
Deprecated.- Overrides:
onHttp2FrameStreamException
in classHttp2FrameCodec
-
onHttp2GoAwayFrame
private void onHttp2GoAwayFrame(ChannelHandlerContext ctx, Http2GoAwayFrame goAwayFrame)
Deprecated.
-
channelReadComplete
public final void channelReadComplete(ChannelHandlerContext ctx) throws java.lang.Exception
Deprecated.Notifies any child streams of the read completion.- Specified by:
channelReadComplete
in interfaceChannelInboundHandler
- Overrides:
channelReadComplete
in classHttp2ConnectionHandler
- Throws:
java.lang.Exception
-
processPendingReadCompleteQueue
private void processPendingReadCompleteQueue()
Deprecated.
-
channelRead
public final void channelRead(ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception
Deprecated.Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireChannelRead(Object)
to forward to the nextChannelInboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
channelRead
in interfaceChannelInboundHandler
- Overrides:
channelRead
in classByteToMessageDecoder
- Throws:
java.lang.Exception
-
channelWritabilityChanged
public final void channelWritabilityChanged(ChannelHandlerContext ctx) throws java.lang.Exception
Deprecated.Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireChannelWritabilityChanged()
to forward to the nextChannelInboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
channelWritabilityChanged
in interfaceChannelInboundHandler
- Overrides:
channelWritabilityChanged
in classHttp2ConnectionHandler
- Throws:
java.lang.Exception
-
onUserEventTriggered
final void onUserEventTriggered(ChannelHandlerContext ctx, java.lang.Object evt) throws java.lang.Exception
Deprecated.- Overrides:
onUserEventTriggered
in classHttp2FrameCodec
- Throws:
java.lang.Exception
-
flush0
final void flush0(ChannelHandlerContext ctx)
Deprecated.
-
-