Home / Function/ distributeToChildren() — netty Function Reference

distributeToChildren() — netty Function Reference

Architecture documentation for the distributeToChildren() function in WeightedFairQueueByteDistributor.java from the netty codebase.

Function java Buffer Allocators calls 5 called by 1

Entity Profile

Dependency Diagram

graph TD
  fee5801b_b90a_5512_05a6_7256df952cd8["distributeToChildren()"]
  f6394c11_feeb_5e3e_8717_b7d2d36bbf34["WeightedFairQueueByteDistributor"]
  fee5801b_b90a_5512_05a6_7256df952cd8 -->|defined in| f6394c11_feeb_5e3e_8717_b7d2d36bbf34
  a477195a_8699_0505_29de_529047b61e11["distribute()"]
  a477195a_8699_0505_29de_529047b61e11 -->|calls| fee5801b_b90a_5512_05a6_7256df952cd8
  f18e1329_3594_56a2_3d34_0b8428bec24a["setDistributing()"]
  fee5801b_b90a_5512_05a6_7256df952cd8 -->|calls| f18e1329_3594_56a2_3d34_0b8428bec24a
  a477195a_8699_0505_29de_529047b61e11["distribute()"]
  fee5801b_b90a_5512_05a6_7256df952cd8 -->|calls| a477195a_8699_0505_29de_529047b61e11
  44e16369_7668_ebe2_f028_9d6680dd00c4["updatePseudoTime()"]
  fee5801b_b90a_5512_05a6_7256df952cd8 -->|calls| 44e16369_7668_ebe2_f028_9d6680dd00c4
  a4ebbe86_f0f3_1567_2660_42bd80803003["unsetDistributing()"]
  fee5801b_b90a_5512_05a6_7256df952cd8 -->|calls| a4ebbe86_f0f3_1567_2660_42bd80803003
  6c6e7768_ac9d_94df_095e_382a53117614["offerPseudoTimeQueue()"]
  fee5801b_b90a_5512_05a6_7256df952cd8 -->|calls| 6c6e7768_ac9d_94df_095e_382a53117614
  style fee5801b_b90a_5512_05a6_7256df952cd8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/WeightedFairQueueByteDistributor.java lines 313–340

    private int distributeToChildren(int maxBytes, Writer writer, State state) throws Http2Exception {
        long oldTotalQueuedWeights = state.totalQueuedWeights;
        State childState = state.pollPseudoTimeQueue();
        State nextChildState = state.peekPseudoTimeQueue();
        childState.setDistributing();
        try {
            assert nextChildState == null || nextChildState.pseudoTimeToWrite >= childState.pseudoTimeToWrite :
                "nextChildState[" + nextChildState.streamId + "].pseudoTime(" + nextChildState.pseudoTimeToWrite +
                ") < " + " childState[" + childState.streamId + "].pseudoTime(" + childState.pseudoTimeToWrite + ')';
            int nsent = distribute(nextChildState == null ? maxBytes :
                            min(maxBytes, (int) min((nextChildState.pseudoTimeToWrite - childState.pseudoTimeToWrite) *
                                               childState.weight / oldTotalQueuedWeights + allocationQuantum, MAX_VALUE)
                               ),
                               writer,
                               childState);
            state.pseudoTime += nsent;
            childState.updatePseudoTime(state, nsent, oldTotalQueuedWeights);
            return nsent;
        } finally {
            childState.unsetDistributing();
            // Do in finally to ensure the internal flags is not corrupted if an exception is thrown.
            // The offer operation is delayed until we unroll up the recursive stack, so we don't have to remove from
            // the priority pseudoTimeQueue due to a write operation.
            if (childState.activeCountForTree != 0) {
                state.offerPseudoTimeQueue(childState);
            }
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does distributeToChildren() do?
distributeToChildren() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/WeightedFairQueueByteDistributor.java.
Where is distributeToChildren() defined?
distributeToChildren() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/WeightedFairQueueByteDistributor.java at line 313.
What does distributeToChildren() call?
distributeToChildren() calls 5 function(s): distribute, offerPseudoTimeQueue, setDistributing, unsetDistributing, updatePseudoTime.
What calls distributeToChildren()?
distributeToChildren() is called by 1 function(s): distribute.

Analyze Your Own Codebase

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

Try Supermodel Free