Home / Class/ MultiplexInboundStream Class — netty Architecture

MultiplexInboundStream Class — netty Architecture

Architecture documentation for the MultiplexInboundStream class in Http2MultiplexTransportTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  cbe43862_9765_7481_8f83_05c7dedcb546["MultiplexInboundStream"]
  93eaa879_d304_f987_514e_e595eaef7e78["Http2MultiplexTransportTest.java"]
  cbe43862_9765_7481_8f83_05c7dedcb546 -->|defined in| 93eaa879_d304_f987_514e_e595eaef7e78
  ad1db823_1ac5_94df_71d1_7a63906878db["MultiplexInboundStream()"]
  cbe43862_9765_7481_8f83_05c7dedcb546 -->|method| ad1db823_1ac5_94df_71d1_7a63906878db
  ddc09e7c_92de_4aa4_bf62_25ac0d49ef36["channelRead()"]
  cbe43862_9765_7481_8f83_05c7dedcb546 -->|method| ddc09e7c_92de_4aa4_bf62_25ac0d49ef36
  a8136434_be4c_e0dc_6e2e_2efbaeb9f660["channelInactive()"]
  cbe43862_9765_7481_8f83_05c7dedcb546 -->|method| a8136434_be4c_e0dc_6e2e_2efbaeb9f660
  828097d6_617a_3b9d_5264_825a50c34a44["String()"]
  cbe43862_9765_7481_8f83_05c7dedcb546 -->|method| 828097d6_617a_3b9d_5264_825a50c34a44

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java lines 122–163

    private static final class MultiplexInboundStream extends ChannelInboundHandlerAdapter {
        ChannelFuture responseFuture;
        final AtomicInteger handlerInactivatedFlushed;
        final AtomicInteger handleInactivatedNotFlushed;
        final CountDownLatch latchHandlerInactive;
        static final String LARGE_STRING = generateLargeString(10240);

        MultiplexInboundStream(AtomicInteger handleInactivatedFlushed,
                               AtomicInteger handleInactivatedNotFlushed, CountDownLatch latchHandlerInactive) {
            this.handlerInactivatedFlushed = handleInactivatedFlushed;
            this.handleInactivatedNotFlushed = handleInactivatedNotFlushed;
            this.latchHandlerInactive = latchHandlerInactive;
        }

        @Override
        public void channelRead(final ChannelHandlerContext ctx, Object msg) {
            if (msg instanceof Http2HeadersFrame && ((Http2HeadersFrame) msg).isEndStream()) {
                ByteBuf response = Unpooled.copiedBuffer(LARGE_STRING, CharsetUtil.US_ASCII);
                responseFuture = ctx.writeAndFlush(new DefaultHttp2DataFrame(response, true));
            }
            ReferenceCountUtil.release(msg);
        }

        @Override
        public void channelInactive(ChannelHandlerContext ctx) throws Exception {
            if (responseFuture.isSuccess()) {
                handlerInactivatedFlushed.incrementAndGet();
            } else {
                handleInactivatedNotFlushed.incrementAndGet();
            }
            latchHandlerInactive.countDown();
            ctx.fireChannelInactive();
        }

        private static String generateLargeString(int sizeInBytes) {
            StringBuilder sb = new StringBuilder(sizeInBytes);
            for (int i = 0; i < sizeInBytes; i++) {
                sb.append('X');
            }
            return sb.toString();
        }
    }

Frequently Asked Questions

What is the MultiplexInboundStream class?
MultiplexInboundStream is a class in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java.
Where is MultiplexInboundStream defined?
MultiplexInboundStream is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java at line 122.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free