Home / Function/ updateStreamableBytes() — netty Function Reference

updateStreamableBytes() — netty Function Reference

Architecture documentation for the updateStreamableBytes() function in UniformStreamByteDistributor.java from the netty codebase.

Function java Buffer Allocators calls 2 called by 2

Entity Profile

Dependency Diagram

graph TD
  eb6bf10d_b6fd_8515_c69e_9cd09b8d3ba9["updateStreamableBytes()"]
  52e74647_0bb8_efef_82ff_44ea07c3c527["State"]
  eb6bf10d_b6fd_8515_c69e_9cd09b8d3ba9 -->|defined in| 52e74647_0bb8_efef_82ff_44ea07c3c527
  156bbb11_157a_2a4e_aa30_e317b707854a["updateStreamableBytes()"]
  156bbb11_157a_2a4e_aa30_e317b707854a -->|calls| eb6bf10d_b6fd_8515_c69e_9cd09b8d3ba9
  1e906bd4_0f9f_15e3_0931_d67395e16bd9["close()"]
  1e906bd4_0f9f_15e3_0931_d67395e16bd9 -->|calls| eb6bf10d_b6fd_8515_c69e_9cd09b8d3ba9
  156bbb11_157a_2a4e_aa30_e317b707854a["updateStreamableBytes()"]
  eb6bf10d_b6fd_8515_c69e_9cd09b8d3ba9 -->|calls| 156bbb11_157a_2a4e_aa30_e317b707854a
  7d4300b6_0588_0233_9ef1_d99a483aea7e["addToQueue()"]
  eb6bf10d_b6fd_8515_c69e_9cd09b8d3ba9 -->|calls| 7d4300b6_0588_0233_9ef1_d99a483aea7e
  style eb6bf10d_b6fd_8515_c69e_9cd09b8d3ba9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/UniformStreamByteDistributor.java lines 142–162

        void updateStreamableBytes(int newStreamableBytes, boolean hasFrame, int windowSize) {
            assert hasFrame || newStreamableBytes == 0 :
                "hasFrame: " + hasFrame + " newStreamableBytes: " + newStreamableBytes;

            int delta = newStreamableBytes - streamableBytes;
            if (delta != 0) {
                streamableBytes = newStreamableBytes;
                totalStreamableBytes += delta;
            }
            // In addition to only enqueuing state when they have frames we enforce the following restrictions:
            // 1. If the window has gone negative. We never want to queue a state. However we also don't want to
            //    Immediately remove the item if it is already queued because removal from deque is O(n). So
            //    we allow it to stay queued and rely on the distribution loop to remove this state.
            // 2. If the window is zero we only want to queue if we are not writing. If we are writing that means
            //    we gave the state a chance to write zero length frames. We wait until updateStreamableBytes is
            //    called again before this state is allowed to write.
            windowNegative = windowSize < 0;
            if (hasFrame && (windowSize > 0 || windowSize == 0 && !writing)) {
                addToQueue();
            }
        }

Domain

Subdomains

Frequently Asked Questions

What does updateStreamableBytes() do?
updateStreamableBytes() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/UniformStreamByteDistributor.java.
Where is updateStreamableBytes() defined?
updateStreamableBytes() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/UniformStreamByteDistributor.java at line 142.
What does updateStreamableBytes() call?
updateStreamableBytes() calls 2 function(s): addToQueue, updateStreamableBytes.
What calls updateStreamableBytes()?
updateStreamableBytes() is called by 2 function(s): close, updateStreamableBytes.

Analyze Your Own Codebase

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

Try Supermodel Free