Home / Function/ channelRead0() — netty Function Reference

channelRead0() — netty Function Reference

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

Function java Buffer Telemetry calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  3f6bd014_d001_c3a0_8233_056f4ad262a7["channelRead0()"]
  a564e1e7_3954_c4e6_4213_33ab700f033a["ServerHandler"]
  3f6bd014_d001_c3a0_8233_056f4ad262a7 -->|defined in| a564e1e7_3954_c4e6_4213_33ab700f033a
  95e1288e_b36b_7855_418d_399a527d5032["channelRead0()"]
  95e1288e_b36b_7855_418d_399a527d5032 -->|calls| 3f6bd014_d001_c3a0_8233_056f4ad262a7
  95e1288e_b36b_7855_418d_399a527d5032["channelRead0()"]
  3f6bd014_d001_c3a0_8233_056f4ad262a7 -->|calls| 95e1288e_b36b_7855_418d_399a527d5032
  style 3f6bd014_d001_c3a0_8233_056f4ad262a7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/TrafficShapingHandlerTest.java lines 527–594

        @Override
        public void channelRead0(final ChannelHandlerContext ctx, ByteBuf in) throws Exception {
            byte[] actual = new byte[in.readableBytes()];
            int nb = actual.length / messageSize;
            loggerServer.info("Step: " + step + " Read: " + nb + " blocks");
            in.readBytes(actual);
            long timestamp = TrafficCounter.milliSecondFromNano();
            int isAutoRead = 0;
            int laststep = step;
            for (int i = 0; i < nb; i++) {
                multipleMessage[step]--;
                if (multipleMessage[step] == 0) {
                    // setAutoRead test
                    if (autoRead != null) {
                        isAutoRead = autoRead[step];
                    }
                    step++;
                }
            }
            if (laststep != step) {
                // setAutoRead test
                if (autoRead != null && isAutoRead != 2) {
                    if (isAutoRead != 0) {
                        loggerServer.info("Step: " + step + " Set AutoRead: " + (isAutoRead > 0));
                        channel.config().setAutoRead(isAutoRead > 0);
                    } else {
                        loggerServer.info("Step: " + step + " AutoRead: NO");
                    }
                }
            }
            Thread.sleep(10);
            loggerServer.debug("Step: " + step + " Write: " + nb);
            for (int i = 0; i < nb; i++) {
                channel.write(Unpooled.copyLong(timestamp));
            }
            channel.flush();
            if (laststep != step) {
                // setAutoRead test
                if (isAutoRead != 0) {
                    if (isAutoRead < 0) {
                        final int exactStep = step;
                        long wait = isAutoRead == -1? minimalms : stepms + minimalms;
                        if (isAutoRead == -3) {
                            wait = stepms * 3;
                        }
                        executor.schedule(new Runnable() {
                            @Override
                            public void run() {
                                loggerServer.info("Step: " + exactStep + " Reset AutoRead");
                                channel.config().setAutoRead(true);
                            }
                        }, wait, TimeUnit.MILLISECONDS);
                    } else {
                        if (isAutoRead > 1) {
                            loggerServer.debug("Step: " + step + " Will Set AutoRead: True");
                            final int exactStep = step;
                            executor.schedule(new Runnable() {
                                @Override
                                public void run() {
                                    loggerServer.info("Step: " + exactStep + " Set AutoRead: True");
                                    channel.config().setAutoRead(true);
                                }
                            }, stepms + minimalms, TimeUnit.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/TrafficShapingHandlerTest.java.
Where is channelRead0() defined?
channelRead0() is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/TrafficShapingHandlerTest.java at line 527.
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