distribute() — netty Function Reference
Architecture documentation for the distribute() function in UniformStreamByteDistributor.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 9aa76083_f372_5469_df81_9b5573b58931["distribute()"] 5377af2d_bff0_e163_253c_99c207830ae4["UniformStreamByteDistributor"] 9aa76083_f372_5469_df81_9b5573b58931 -->|defined in| 5377af2d_bff0_e163_253c_99c207830ae4 5f2d025b_d4ae_5222_7318_105d186fc0cd["write()"] 9aa76083_f372_5469_df81_9b5573b58931 -->|calls| 5f2d025b_d4ae_5222_7318_105d186fc0cd style 9aa76083_f372_5469_df81_9b5573b58931 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http2/src/main/java/io/netty/handler/codec/http2/UniformStreamByteDistributor.java lines 89–122
@Override
public boolean distribute(int maxBytes, Writer writer) throws Http2Exception {
final int size = queue.size();
if (size == 0) {
return totalStreamableBytes > 0;
}
final int chunkSize = max(minAllocationChunk, maxBytes / size);
State state = queue.pollFirst();
do {
state.enqueued = false;
if (state.windowNegative) {
continue;
}
if (maxBytes == 0 && state.streamableBytes > 0) {
// Stop at the first state that can't send. Add this state back to the head of the queue. Note
// that empty frames at the head of the queue will always be written, assuming the stream window
// is not negative.
queue.addFirst(state);
state.enqueued = true;
break;
}
// Allocate as much data as we can for this stream.
int chunk = min(chunkSize, min(maxBytes, state.streamableBytes));
maxBytes -= chunk;
// Write the allocated bytes and enqueue as necessary.
state.write(chunk, writer);
} while ((state = queue.pollFirst()) != null);
return totalStreamableBytes > 0;
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does distribute() do?
distribute() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/UniformStreamByteDistributor.java.
Where is distribute() defined?
distribute() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/UniformStreamByteDistributor.java at line 89.
What does distribute() call?
distribute() calls 1 function(s): write.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free