Http2MultiplexHandler Class — netty Architecture
Architecture documentation for the Http2MultiplexHandler class in Http2MultiplexHandler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 42ad104c_27ce_3949_598d_983571f45120["Http2MultiplexHandler"] 62002693_e858_0e83_631a_cef50b1bba9c["Http2MultiplexHandler.java"] 42ad104c_27ce_3949_598d_983571f45120 -->|defined in| 62002693_e858_0e83_631a_cef50b1bba9c f48b7cb7_9877_5ec1_5902_dcf90106758a["Http2MultiplexHandler()"] 42ad104c_27ce_3949_598d_983571f45120 -->|method| f48b7cb7_9877_5ec1_5902_dcf90106758a 5c409190_1743_0fa4_a62a_59d360ea11b0["registerDone()"] 42ad104c_27ce_3949_598d_983571f45120 -->|method| 5c409190_1743_0fa4_a62a_59d360ea11b0 9a09de1c_d1ea_fc2d_b91b_7edd665f44ae["handlerAdded0()"] 42ad104c_27ce_3949_598d_983571f45120 -->|method| 9a09de1c_d1ea_fc2d_b91b_7edd665f44ae d50b9f2a_336a_6f36_1e20_98021f6826ea["handlerRemoved0()"] 42ad104c_27ce_3949_598d_983571f45120 -->|method| d50b9f2a_336a_6f36_1e20_98021f6826ea a4fe4bba_654a_3aa2_9f5e_6a5657ed6a2d["channelRead()"] 42ad104c_27ce_3949_598d_983571f45120 -->|method| a4fe4bba_654a_3aa2_9f5e_6a5657ed6a2d e8d6be38_e672_2ab0_dcb4_017d2c8f612c["channelWritabilityChanged()"] 42ad104c_27ce_3949_598d_983571f45120 -->|method| e8d6be38_e672_2ab0_dcb4_017d2c8f612c 4210b905_a74a_3889_a149_79ceab54fca7["userEventTriggered()"] 42ad104c_27ce_3949_598d_983571f45120 -->|method| 4210b905_a74a_3889_a149_79ceab54fca7 294891f1_47e2_3235_6b36_567f871ce79b["Http2StreamChannel()"] 42ad104c_27ce_3949_598d_983571f45120 -->|method| 294891f1_47e2_3235_6b36_567f871ce79b 098ea8fd_d159_abdb_cfe2_2db0c47476aa["exceptionCaught()"] 42ad104c_27ce_3949_598d_983571f45120 -->|method| 098ea8fd_d159_abdb_cfe2_2db0c47476aa 195994a1_32ac_9be7_2f1e_2a1634ab39a8["fireExceptionCaughtForActiveStream()"] 42ad104c_27ce_3949_598d_983571f45120 -->|method| 195994a1_32ac_9be7_2f1e_2a1634ab39a8 d62c1758_06e8_d0f2_282d_fb82aafdbba4["isServer()"] 42ad104c_27ce_3949_598d_983571f45120 -->|method| d62c1758_06e8_d0f2_282d_fb82aafdbba4 6d465bcf_00d0_5886_8379_c985b729d3c1["onHttp2GoAwayFrame()"] 42ad104c_27ce_3949_598d_983571f45120 -->|method| 6d465bcf_00d0_5886_8379_c985b729d3c1 c6828173_1014_42d3_4333_88ff1adbdd55["channelReadComplete()"] 42ad104c_27ce_3949_598d_983571f45120 -->|method| c6828173_1014_42d3_4333_88ff1adbdd55
Relationship Graph
Source Code
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2MultiplexHandler.java lines 100–408
public final class Http2MultiplexHandler extends Http2ChannelDuplexHandler {
static final ChannelFutureListener CHILD_CHANNEL_REGISTRATION_LISTENER = Http2MultiplexHandler::registerDone;
private final ChannelHandler inboundStreamHandler;
private final ChannelHandler upgradeStreamHandler;
private final Queue<AbstractHttp2StreamChannel> readCompletePendingQueue =
new MaxCapacityQueue<AbstractHttp2StreamChannel>(new ArrayDeque<AbstractHttp2StreamChannel>(8),
// Choose 100 which is what is used most of the times as default.
Http2CodecUtil.SMALLEST_MAX_CONCURRENT_STREAMS);
private boolean parentReadInProgress;
private int idCount;
// Need to be volatile as accessed from within the Http2MultiplexHandlerStreamChannel in a multi-threaded fashion.
private volatile ChannelHandlerContext ctx;
/**
* Creates a new instance
*
* @param inboundStreamHandler the {@link ChannelHandler} that will be added to the {@link ChannelPipeline} of
* the {@link Channel}s created for new inbound streams.
*/
public Http2MultiplexHandler(ChannelHandler inboundStreamHandler) {
this(inboundStreamHandler, null);
}
/**
* Creates a new instance
*
* @param inboundStreamHandler the {@link ChannelHandler} that will be added to the {@link ChannelPipeline} of
* the {@link Channel}s created for new inbound streams.
* @param upgradeStreamHandler the {@link ChannelHandler} that will be added to the {@link ChannelPipeline} of the
* upgraded {@link Channel}.
*/
public Http2MultiplexHandler(ChannelHandler inboundStreamHandler, ChannelHandler upgradeStreamHandler) {
this.inboundStreamHandler = ObjectUtil.checkNotNull(inboundStreamHandler, "inboundStreamHandler");
this.upgradeStreamHandler = upgradeStreamHandler;
}
static void registerDone(ChannelFuture future) {
// Handle any errors that occurred on the local thread while registering. Even though
// failures can happen after this point, they will be handled by the channel by closing the
// childChannel.
if (!future.isSuccess()) {
Channel childChannel = future.channel();
if (childChannel.isRegistered()) {
childChannel.close();
} else {
childChannel.unsafe().closeForcibly();
}
}
}
@Override
protected void handlerAdded0(ChannelHandlerContext ctx) {
if (ctx.executor() != ctx.channel().eventLoop()) {
throw new IllegalStateException("EventExecutor must be EventLoop of Channel");
}
this.ctx = ctx;
}
@Override
protected void handlerRemoved0(ChannelHandlerContext ctx) {
readCompletePendingQueue.clear();
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
parentReadInProgress = true;
if (msg instanceof Http2StreamFrame) {
if (msg instanceof Http2WindowUpdateFrame) {
// We dont want to propagate update frames to the user
return;
}
Http2StreamFrame streamFrame = (Http2StreamFrame) msg;
DefaultHttp2FrameStream s =
(DefaultHttp2FrameStream) streamFrame.stream();
AbstractHttp2StreamChannel channel = (AbstractHttp2StreamChannel) s.attachment;
if (msg instanceof Http2ResetFrame || msg instanceof Http2PriorityFrame) {
Source
Frequently Asked Questions
What is the Http2MultiplexHandler class?
Http2MultiplexHandler is a class in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2MultiplexHandler.java.
Where is Http2MultiplexHandler defined?
Http2MultiplexHandler is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2MultiplexHandler.java at line 100.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free