Home / Function/ computeBalancedWait() — netty Function Reference

computeBalancedWait() — netty Function Reference

Architecture documentation for the computeBalancedWait() function in GlobalChannelTrafficShapingHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  69a96252_28cc_c201_a07c_016f54efb94c["computeBalancedWait()"]
  70857fc2_a134_e299_7b48_1738d53c0016["GlobalChannelTrafficShapingHandler"]
  69a96252_28cc_c201_a07c_016f54efb94c -->|defined in| 70857fc2_a134_e299_7b48_1738d53c0016
  ae77ebe1_84b2_b0c0_804c_46784f484fe4["channelRead()"]
  ae77ebe1_84b2_b0c0_804c_46784f484fe4 -->|calls| 69a96252_28cc_c201_a07c_016f54efb94c
  95f889b3_eae3_1bd8_4f15_602c55f0e60f["write()"]
  95f889b3_eae3_1bd8_4f15_602c55f0e60f -->|calls| 69a96252_28cc_c201_a07c_016f54efb94c
  style 69a96252_28cc_c201_a07c_016f54efb94c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/traffic/GlobalChannelTrafficShapingHandler.java lines 348–368

    private long computeBalancedWait(float maxLocal, float maxGlobal, long wait) {
        if (maxGlobal == 0) {
            // no change
            return wait;
        }
        float ratio = maxLocal / maxGlobal;
        // if in the boundaries, same value
        if (ratio > maxDeviation) {
            if (ratio < 1 - maxDeviation) {
                return wait;
            } else {
                ratio = slowDownFactor;
                if (wait < MINIMAL_WAIT) {
                    wait = MINIMAL_WAIT;
                }
            }
        } else {
            ratio = accelerationFactor;
        }
        return (long) (wait * ratio);
    }

Domain

Subdomains

Frequently Asked Questions

What does computeBalancedWait() do?
computeBalancedWait() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/traffic/GlobalChannelTrafficShapingHandler.java.
Where is computeBalancedWait() defined?
computeBalancedWait() is defined in handler/src/main/java/io/netty/handler/traffic/GlobalChannelTrafficShapingHandler.java at line 348.
What calls computeBalancedWait()?
computeBalancedWait() is called by 2 function(s): channelRead, write.

Analyze Your Own Codebase

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

Try Supermodel Free