StreamByteDistributor that ignores stream priority and uniformly allocates bytes to all
streams. This class uses a minimum chunk size that will be allocated to each stream. While
fewer streams may be written to in each call to distribute(int, Writer), doing this
should improve the goodput on each written stream.
| Modifier and Type | Class and Description |
|---|---|
| private class | UniformStreamByteDistributor.
The remote flow control state for a single stream. |
| Modifier and Type | Field and Description |
|---|---|
| private int | minAllocationChunk
The minimum number of bytes that we will attempt to allocate to a stream. |
| private final Deque | |
| private final Http2Connection. | |
| private long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | distribute(int
the maximum number of bytes to write. maxBytes, StreamByteDistributor.Implements io. maxBytes to those streams containing streamable bytes and
iterates across those streams to write the appropriate bytes.
|
| public void | minAllocationChunk(int
the minimum number of bytes that will be allocated to each stream.
Must be > 0. minAllocationChunk)Sets the minimum allocation chunk that will be allocated to each stream. |
| private UniformStreamByteDistributor. | |
| public void | updateDependencyTree(int
The stream identifier associated with the child stream. childStreamId, int The stream identifier associated with the parent stream. May be parentStreamId, short 0,
to make childStreamId and immediate child of the connection.The weight which is used relative to other child streams for weight, boolean parentStreamId. This value
must be between 1 and 256 (inclusive).If exclusive)childStreamId should be the exclusive dependency of parentStreamId.Implements io. |
| public void | updateStreamableBytes(StreamByteDistributor.
Implements io. |
| minAllocationChunk | back to summary |
|---|---|
| private int minAllocationChunk The minimum number of bytes that we will attempt to allocate to a stream. This is to help improve goodput on a per-stream basis. | |
| queue | back to summary |
|---|---|
| private final Deque<UniformStreamByteDistributor. | |
| stateKey | back to summary |
|---|---|
| private final Http2Connection. | |
| totalStreamableBytes | back to summary |
|---|---|
| private long totalStreamableBytes | |
| UniformStreamByteDistributor | back to summary |
|---|---|
| public UniformStreamByteDistributor(Http2Connection connection) | |
| distribute | back to summary |
|---|---|
| public boolean distribute(int maxBytes, StreamByteDistributor. Implements io. Doc from io. Distributes up to The streamable bytes are not automatically updated by calling this method. It is up to the
caller to indicate the number of bytes streamable after the write by calling
| |
| minAllocationChunk | back to summary |
|---|---|
| public void minAllocationChunk(int minAllocationChunk) Sets the minimum allocation chunk that will be allocated to each stream. Defaults to 1KiB.
| |
| state | back to summary |
|---|---|
| private UniformStreamByteDistributor. | |
| updateDependencyTree | back to summary |
|---|---|
| public void updateDependencyTree(int childStreamId, int parentStreamId, short weight, boolean exclusive) Implements io. Doc from io. Explicitly update the dependency tree. This method is called independently of stream state changes.
| |
| updateStreamableBytes | back to summary |
|---|---|
| public void updateStreamableBytes(StreamByteDistributor. Implements io. Doc from io. Called when the streamable bytes for a stream has changed. Until this method is called for the first time for a give stream, the stream is assumed to have no streamable bytes.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv boolean | |
| pack-priv final Http2Stream | |
| pack-priv int | |
| pack-priv boolean | |
| pack-priv boolean |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | write(int numBytes, StreamByteDistributor.
Write any allocated bytes for the given stream and updates the streamable bytes, assuming all of the bytes will be written. |
| enqueued | back to summary |
|---|---|
| pack-priv boolean enqueued | |
| stream | back to summary |
|---|---|
| pack-priv final Http2Stream stream | |
| streamableBytes | back to summary |
|---|---|
| pack-priv int streamableBytes | |
| windowNegative | back to summary |
|---|---|
| pack-priv boolean windowNegative | |
| writing | back to summary |
|---|---|
| pack-priv boolean writing | |
| State | back to summary |
|---|---|
| pack-priv State(Http2Stream stream) | |
| addToQueue | back to summary |
|---|---|
| pack-priv void addToQueue() | |
| close | back to summary |
|---|---|
| pack-priv void close() | |
| removeFromQueue | back to summary |
|---|---|
| pack-priv void removeFromQueue() | |
| updateStreamableBytes | back to summary |
|---|---|
| pack-priv void updateStreamableBytes(int newStreamableBytes, boolean hasFrame, int windowSize) | |
| write | back to summary |
|---|---|
| pack-priv void write(int numBytes, StreamByteDistributor. Write any allocated bytes for the given stream and updates the streamable bytes, assuming all of the bytes will be written. | |