Home / Function/ streamHandlerInactivatedResponseFlushed() — netty Function Reference

streamHandlerInactivatedResponseFlushed() — netty Function Reference

Architecture documentation for the streamHandlerInactivatedResponseFlushed() function in Http2MultiplexTransportTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ba5dd52d_0e41_5760_c529_eeb0a10a4957["streamHandlerInactivatedResponseFlushed()"]
  91fc51f7_5bfd_40ef_a0e8_b98c3ed99f48["Http2MultiplexTransportTest"]
  ba5dd52d_0e41_5760_c529_eeb0a10a4957 -->|defined in| 91fc51f7_5bfd_40ef_a0e8_b98c3ed99f48
  ad1db823_1ac5_94df_71d1_7a63906878db["MultiplexInboundStream()"]
  ba5dd52d_0e41_5760_c529_eeb0a10a4957 -->|calls| ad1db823_1ac5_94df_71d1_7a63906878db
  ddc09e7c_92de_4aa4_bf62_25ac0d49ef36["channelRead()"]
  ba5dd52d_0e41_5760_c529_eeb0a10a4957 -->|calls| ddc09e7c_92de_4aa4_bf62_25ac0d49ef36
  style ba5dd52d_0e41_5760_c529_eeb0a10a4957 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java lines 651–749

    @Test
    @Timeout(value = 120000L, unit = MILLISECONDS)
    public void streamHandlerInactivatedResponseFlushed() throws InterruptedException {
        EventLoopGroup serverEventLoopGroup = null;
        EventLoopGroup clientEventLoopGroup = null;

        try {
            serverEventLoopGroup = new MultiThreadIoEventLoopGroup(1, new ThreadFactory() {
                @Override
                public Thread newThread(Runnable r) {
                    return new Thread(r, "serverloop");
                }
            }, NioIoHandler.newFactory());

            clientEventLoopGroup = new MultiThreadIoEventLoopGroup(1, new ThreadFactory() {
                @Override
                public Thread newThread(Runnable r) {
                    return new Thread(r, "clientloop");
                }
            }, NioIoHandler.newFactory());

            final int streams = 10;
            final CountDownLatch latchClientResponses = new CountDownLatch(streams);
            final CountDownLatch latchHandlerInactive = new CountDownLatch(streams);

            final AtomicInteger handlerInactivatedFlushed = new AtomicInteger();
            final AtomicInteger handleInactivatedNotFlushed = new AtomicInteger();
            final ServerBootstrap sb = new ServerBootstrap();

            sb.group(serverEventLoopGroup);
            sb.channel(NioServerSocketChannel.class);
            sb.childHandler(new ChannelInitializer<Channel>() {
                @Override
                protected void initChannel(Channel ch) {
                    // using a short sndbuf size will trigger writability events
                    ch.config().setOption(ChannelOption.SO_SNDBUF, 1);
                    ch.pipeline().addLast(new Http2FrameCodecBuilder(true).build());
                    ch.pipeline().addLast(new Http2MultiplexHandler(new ChannelInitializer<Channel>() {
                        @Override
                        protected void initChannel(Channel ch) {
                            ch.pipeline().remove(this);
                            ch.pipeline().addLast(new MultiplexInboundStream(handlerInactivatedFlushed,
                                    handleInactivatedNotFlushed, latchHandlerInactive));
                        }
                    }));
                }
            });
            serverChannel = sb.bind(new InetSocketAddress(NetUtil.LOCALHOST, 0)).syncUninterruptibly().channel();

            final Bootstrap bs = new Bootstrap();

            bs.group(clientEventLoopGroup);
            bs.channel(NioSocketChannel.class);
            bs.handler(new ChannelInitializer<Channel>() {
                @Override
                protected void initChannel(Channel ch) {
                    ch.pipeline().addLast(new Http2FrameCodecBuilder(false).build());
                    ch.pipeline().addLast(new Http2MultiplexHandler(DISCARD_HANDLER));
                }
            });

            clientChannel = bs.connect(serverChannel.localAddress()).syncUninterruptibly().channel();
            final Http2StreamChannelBootstrap h2Bootstrap = new Http2StreamChannelBootstrap(clientChannel);
            h2Bootstrap.handler(new ChannelInboundHandlerAdapter() {
                @Override
                public void channelRead(ChannelHandlerContext ctx, Object msg) {
                    if (msg instanceof Http2DataFrame && ((Http2DataFrame) msg).isEndStream()) {
                        latchClientResponses.countDown();
                    }
                    ReferenceCountUtil.release(msg);
                }
                @Override
                public boolean isSharable() {
                    return true;
                }
            });

            List<ChannelFuture> streamFutures = new ArrayList<ChannelFuture>();
            for (int i = 0; i < streams; i ++) {
                Http2StreamChannel stream = h2Bootstrap.open().syncUninterruptibly().getNow();
                streamFutures.add(stream.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers(), true)));

Domain

Subdomains

Frequently Asked Questions

What does streamHandlerInactivatedResponseFlushed() do?
streamHandlerInactivatedResponseFlushed() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java.
Where is streamHandlerInactivatedResponseFlushed() defined?
streamHandlerInactivatedResponseFlushed() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java at line 651.
What does streamHandlerInactivatedResponseFlushed() call?
streamHandlerInactivatedResponseFlushed() calls 2 function(s): MultiplexInboundStream, channelRead.

Analyze Your Own Codebase

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

Try Supermodel Free