Home / Function/ writabilityOfParentIsRespected() — netty Function Reference

writabilityOfParentIsRespected() — netty Function Reference

Architecture documentation for the writabilityOfParentIsRespected() function in Http2MultiplexTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  f4746236_ecf6_53c6_a3c0_f59c06223cb6["writabilityOfParentIsRespected()"]
  4745ff96_ed57_3bd8_9861_4b786d0b6e09["Http2MultiplexTest"]
  f4746236_ecf6_53c6_a3c0_f59c06223cb6 -->|defined in| 4745ff96_ed57_3bd8_9861_4b786d0b6e09
  b9b63893_76d6_8a34_cbb9_a71b8eeaf1c2["flush()"]
  f4746236_ecf6_53c6_a3c0_f59c06223cb6 -->|calls| b9b63893_76d6_8a34_cbb9_a71b8eeaf1c2
  style f4746236_ecf6_53c6_a3c0_f59c06223cb6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTest.java lines 1109–1158

    @Test
    public void writabilityOfParentIsRespected() {
        Http2StreamChannel childChannel = newOutboundStream(new ChannelInboundHandlerAdapter());
        childChannel.config().setWriteBufferWaterMark(new WriteBufferWaterMark(2048, 4096));
        parentChannel.config().setWriteBufferWaterMark(new WriteBufferWaterMark(256, 512));
        assertTrue(childChannel.isWritable());
        assertTrue(parentChannel.isActive());

        childChannel.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers()));
        parentChannel.flush();

        assertTrue(childChannel.isWritable());
        childChannel.write(new DefaultHttp2DataFrame(Unpooled.buffer().writeZero(256)));
        assertTrue(childChannel.isWritable());
        childChannel.writeAndFlush(new DefaultHttp2DataFrame(Unpooled.buffer().writeZero(512)));

        long bytesBeforeUnwritable = childChannel.bytesBeforeUnwritable();
        assertNotEquals(0, bytesBeforeUnwritable);
        // Add something to the ChannelOutboundBuffer of the parent to simulate queuing in the parents channel buffer
        // and verify that this only affect the writability of the parent channel while the child stays writable
        // until it used all of its credits.
        parentChannel.unsafe().outboundBuffer().addMessage(
                Unpooled.buffer().writeZero(800), 800, parentChannel.voidPromise());
        assertFalse(parentChannel.isWritable());

        assertTrue(childChannel.isWritable());
        assertEquals(4097, childChannel.bytesBeforeUnwritable());

        // Flush everything which simulate writing everything to the socket.
        parentChannel.flush();
        assertTrue(parentChannel.isWritable());
        assertTrue(childChannel.isWritable());
        assertEquals(bytesBeforeUnwritable, childChannel.bytesBeforeUnwritable());

        ChannelFuture future = childChannel.writeAndFlush(new DefaultHttp2DataFrame(
                Unpooled.buffer().writeZero((int) bytesBeforeUnwritable)));
        assertFalse(childChannel.isWritable());
        assertTrue(parentChannel.isWritable());

        parentChannel.flush();
        assertFalse(future.isDone());
        assertTrue(parentChannel.isWritable());
        assertFalse(childChannel.isWritable());

        // Now write an window update frame for the stream which then should ensure we will flush the bytes that were
        // queued in the RemoteFlowController before for the stream.
        frameInboundWriter.writeInboundWindowUpdate(childChannel.stream().id(), (int) bytesBeforeUnwritable);
        assertTrue(childChannel.isWritable());
        assertTrue(future.isDone());
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does writabilityOfParentIsRespected() do?
writabilityOfParentIsRespected() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTest.java.
Where is writabilityOfParentIsRespected() defined?
writabilityOfParentIsRespected() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTest.java at line 1109.
What does writabilityOfParentIsRespected() call?
writabilityOfParentIsRespected() calls 1 function(s): flush.

Analyze Your Own Codebase

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

Try Supermodel Free