Home / Class/ HandleImpl Class — netty Architecture

HandleImpl Class — netty Architecture

Architecture documentation for the HandleImpl class in AdaptiveRecvByteBufAllocator.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ad61c305_adbf_af4c_dc56_2c894bce8773["HandleImpl"]
  1f169dee_b60d_7088_626d_ce9f42c7fb52["AdaptiveRecvByteBufAllocator.java"]
  ad61c305_adbf_af4c_dc56_2c894bce8773 -->|defined in| 1f169dee_b60d_7088_626d_ce9f42c7fb52
  129399c1_f5da_b088_b905_86cbdda496ef["HandleImpl()"]
  ad61c305_adbf_af4c_dc56_2c894bce8773 -->|method| 129399c1_f5da_b088_b905_86cbdda496ef
  a7b43344_4530_5015_2e35_551503de9c6e["lastBytesRead()"]
  ad61c305_adbf_af4c_dc56_2c894bce8773 -->|method| a7b43344_4530_5015_2e35_551503de9c6e
  c05e412f_e314_abe1_c069_c4b9eb3aca99["guess()"]
  ad61c305_adbf_af4c_dc56_2c894bce8773 -->|method| c05e412f_e314_abe1_c069_c4b9eb3aca99
  c0824e27_46a9_b0cb_d473_1730b624bf4a["readComplete()"]
  ad61c305_adbf_af4c_dc56_2c894bce8773 -->|method| c0824e27_46a9_b0cb_d473_1730b624bf4a

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/AdaptiveRecvByteBufAllocator.java lines 45–73

    private final class HandleImpl extends MaxMessageHandle {
        private final AdaptiveCalculator calculator;

        HandleImpl(int minimum, int initial, int maximum) {
            calculator = new AdaptiveCalculator(minimum, initial, maximum);
        }

        @Override
        public void lastBytesRead(int bytes) {
            // If we read as much as we asked for we should check if we need to ramp up the size of our next guess.
            // This helps adjust more quickly when large amounts of data is pending and can avoid going back to
            // the selector to check for more data. Going back to the selector can add significant latency for large
            // data transfers.
            if (bytes == attemptedBytesRead()) {
                calculator.record(bytes);
            }
            super.lastBytesRead(bytes);
        }

        @Override
        public int guess() {
            return calculator.nextSize();
        }

        @Override
        public void readComplete() {
            calculator.record(totalBytesRead());
        }
    }

Frequently Asked Questions

What is the HandleImpl class?
HandleImpl is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/AdaptiveRecvByteBufAllocator.java.
Where is HandleImpl defined?
HandleImpl is defined in transport/src/main/java/io/netty/channel/AdaptiveRecvByteBufAllocator.java at line 45.

Analyze Your Own Codebase

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

Try Supermodel Free