@UnstableApi public final class UniformStreamByteDistributor extends java.lang.Object implements StreamByteDistributor
StreamByteDistributor 。
该类使用将分配给每个流的最小块大小。
尽管每次调用StreamByteDistributor.distribute(int, Writer)时可能会写入较少的数据流,但这样做会改善每个写入数据流的吞吐量。
StreamByteDistributor.StreamState, StreamByteDistributor.Writer| Constructor and Description |
|---|
UniformStreamByteDistributor(Http2Connection connection) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
distribute(int maxBytes, StreamByteDistributor.Writer writer)
将包含流传输字节的流分配到最多
maxBytes ,并遍历这些流以写入适当的字节。
|
void |
minAllocationChunk(int minAllocationChunk)
设置将分配给每个流的最小分配块。
|
void |
updateDependencyTree(int childStreamId, int parentStreamId, short weight, boolean exclusive)
显式更新依赖关系树。
|
void |
updateStreamableBytes(StreamByteDistributor.StreamState streamState)
当流的流传输字节已更改时调用。
|
public UniformStreamByteDistributor(Http2Connection connection)
public void minAllocationChunk(int minAllocationChunk)
minAllocationChunk - 将分配给每个流的最小字节数。
必须> 0。
public void updateStreamableBytes(StreamByteDistributor.StreamState streamState)
StreamByteDistributor复制的描述
updateStreamableBytes在界面
StreamByteDistributor
public void updateDependencyTree(int childStreamId,
int parentStreamId,
short weight,
boolean exclusive)
StreamByteDistributor复制的描述
updateDependencyTree在界面
StreamByteDistributor
childStreamId - 与子流关联的流标识符。
parentStreamId - 与父流关联的流标识符。
可能是0 ,使childStreamId和直接子连接。
weight - 用于parentStreamId相对于其他子流的parentStreamId 。
该值必须介于1和256(含)之间。
exclusive - 如果
childStreamId应该是
childStreamId的独占依赖
parentStreamId 。
public boolean distribute(int maxBytes,
StreamByteDistributor.Writer writer)
throws Http2Exception
StreamByteDistributor
maxBytes给那些包含流传输字节的流并遍历这些流以写入适当的字节。
遍历流的标准是未定义的,并且由实现决定何时停止在给定的流。
流式字节不会通过调用此方法自动更新。 调用者可以通过调用StreamByteDistributor.updateStreamableBytes(StreamState)来指示写入之后流式传输的字节数。
distribute接口
StreamByteDistributor
maxBytes - 要写入的最大字节数。
true是否仍有尚未写入的流式字节,否则为
false 。
Http2Exception - 如果发生内部异常并且内部连接状态将被破坏。
Copyright © 2008–2018 The Netty Project. All rights reserved.