Home / Function/ channelRead0() — netty Function Reference

channelRead0() — netty Function Reference

Architecture documentation for the channelRead0() function in SocketHalfClosedTest.java from the netty codebase.

Function java Buffer Search calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  d339b74f_e58e_53e2_a91c_27d2ff1f05d5["channelRead0()"]
  a8155a97_c3e1_5a97_3f5c_f598bd3af9fe["AutoCloseFalseFollower"]
  d339b74f_e58e_53e2_a91c_27d2ff1f05d5 -->|defined in| a8155a97_c3e1_5a97_3f5c_f598bd3af9fe
  048f4f70_aab1_9685_54cc_9d10fe8b0e4c["channelRead0()"]
  048f4f70_aab1_9685_54cc_9d10fe8b0e4c -->|calls| d339b74f_e58e_53e2_a91c_27d2ff1f05d5
  048f4f70_aab1_9685_54cc_9d10fe8b0e4c["channelRead0()"]
  d339b74f_e58e_53e2_a91c_27d2ff1f05d5 -->|calls| 048f4f70_aab1_9685_54cc_9d10fe8b0e4c
  style d339b74f_e58e_53e2_a91c_27d2ff1f05d5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketHalfClosedTest.java lines 572–594

        @Override
        protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
            bytesRead += msg.readableBytes();
            if (bytesRead >= expectedBytes) {
                // We write a reply and immediately close our end of the socket.
                ByteBuf buf = ctx.alloc().buffer(expectedBytes);
                buf.writerIndex(buf.writerIndex() + expectedBytes);
                ctx.writeAndFlush(buf).addListener(future ->
                        ctx.close().addListener(f -> {
                            // This is a bit racy but there is no better way how to handle this in Java11.
                            // The problem is that on close() the underlying FD will not actually be closed directly
                            // but the close will be done after the Selector did process all events. Because of
                            // this we will need to give it a bit time to ensure the FD is actual closed before we
                            // count down the latch and try to write.
                            ctx.executor().schedule(new Runnable() {
                                @Override
                                public void run() {
                                    followerCloseLatch.countDown();
                                }
                            }, 200, MILLISECONDS);
                        }));
            }
        }

Domain

Subdomains

Called By

Frequently Asked Questions

What does channelRead0() do?
channelRead0() is a function in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketHalfClosedTest.java.
Where is channelRead0() defined?
channelRead0() is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketHalfClosedTest.java at line 572.
What does channelRead0() call?
channelRead0() calls 1 function(s): channelRead0.
What calls channelRead0()?
channelRead0() is called by 1 function(s): channelRead0.

Analyze Your Own Codebase

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

Try Supermodel Free