@UnstableApi public class DefaultHttp2RemoteFlowController extends java.lang.Object implements Http2RemoteFlowController
Http2RemoteFlowController 。
这个类不是线程安全的。 假设是所有方法都必须从单个线程中调用。 通常这个线程是由这个类管理的ChannelHandlerContext的事件循环线程。
Http2RemoteFlowController.FlowControlled, Http2RemoteFlowController.Listener| Constructor and Description |
|---|
DefaultHttp2RemoteFlowController(Http2Connection connection) |
DefaultHttp2RemoteFlowController(Http2Connection connection, Http2RemoteFlowController.Listener listener) |
DefaultHttp2RemoteFlowController(Http2Connection connection, StreamByteDistributor streamByteDistributor) |
DefaultHttp2RemoteFlowController(Http2Connection connection, StreamByteDistributor streamByteDistributor, Http2RemoteFlowController.Listener listener) |
| Modifier and Type | Method and Description |
|---|---|
void |
addFlowControlled(Http2Stream stream, Http2RemoteFlowController.FlowControlled frame)
排队有效载荷以传输到远程端点。
|
ChannelHandlerContext |
channelHandlerContext()
获取应用流量控制的 ChannelHandlerContext 。
|
void |
channelHandlerContext(ChannelHandlerContext ctx)
设置应用流量控制的 ChannelHandlerContext 。
|
void |
channelWritabilityChanged()
|
boolean |
hasFlowControlled(Http2Stream stream)
确定 stream是否有任何Http2RemoteFlowController.FlowControlled当前排队的帧。
|
void |
incrementWindowSize(Http2Stream stream, int delta)
按给定的增量增加流的流量控制窗口的大小。
|
int |
initialWindowSize()
获取用作新流流控制窗口基础的连接范围初始流控制窗口大小。
|
void |
initialWindowSize(int newWindowSize)
设置连接范围的初始流量控制窗口并按增量更新所有流窗口(但不是连接流窗口)。
|
boolean |
isWritable(Http2Stream stream)
确定
stream是否剩余字节用于流量控制窗口。
|
void |
listener(Http2RemoteFlowController.Listener listener)
在流量控制器上设置活动监听器。
|
void |
updateDependencyTree(int childStreamId, int parentStreamId, short weight, boolean exclusive)
显式更新依赖关系树。
|
int |
windowSize(Http2Stream stream)
获取当前可用于发送/接收受流控制控制的帧的给定流的流量控制窗口部分。
|
void |
writePendingBytes()
将流量控制器中待处理的所有数据写入流量控制限制。
|
public DefaultHttp2RemoteFlowController(Http2Connection connection)
public DefaultHttp2RemoteFlowController(Http2Connection connection, StreamByteDistributor streamByteDistributor)
public DefaultHttp2RemoteFlowController(Http2Connection connection, Http2RemoteFlowController.Listener listener)
public DefaultHttp2RemoteFlowController(Http2Connection connection, StreamByteDistributor streamByteDistributor, Http2RemoteFlowController.Listener listener)
public void channelHandlerContext(ChannelHandlerContext ctx) throws Http2Exception
ChannelHandlerContext 。
必须调用这个来正确初始化Http2FlowController 。 不调用它被认为是一个编程错误。
任何排队的FlowControlled对象将被发送。
channelHandlerContext在界面
Http2FlowController
ctx - 应用流量控制的ChannelHandlerContext 。
Http2Exception - 如果发生任何协议相关的错误。
public ChannelHandlerContext channelHandlerContext()
Http2RemoteFlowController
ChannelHandlerContext 。
这仅适用于Http2RemoteFlowController.FlowControlled实现。 谨慎使用。
channelHandlerContext接口
Http2RemoteFlowController
ChannelHandlerContext 。
public void initialWindowSize(int newWindowSize)
throws Http2Exception
Http2FlowController
代表SETTINGS_INITIAL_WINDOW_SIZE的值。 这个方法只能由Netty(不是用户)作为接收SETTINGS帧的结果来SETTINGS 。
initialWindowSize ,界面
Http2FlowController
newWindowSize - 新的初始窗口大小。
Http2Exception - 如果发生任何与协议相关的错误,则抛出。
public int initialWindowSize()
Http2FlowController
代表SETTINGS_INITIAL_WINDOW_SIZE的值。 此方法返回的初始值必须是Http2CodecUtil.DEFAULT_WINDOW_SIZE 。
initialWindowSize在界面
Http2FlowController
public int windowSize(Http2Stream stream)
Http2FlowController
windowSize在界面
Http2FlowController
public boolean isWritable(Http2Stream stream)
Http2RemoteFlowController
stream是否剩余字节用于流量控制窗口。
请注意,此方法尊重通道可写性。 该通道必须是可写的,才能返回true 。
isWritable ,界面
Http2RemoteFlowController
stream - 要测试的流。
true如果
stream剩余字节用于流量控制窗口并且通道可写,
false否则为
false 。
public void channelWritabilityChanged()
throws Http2Exception
Http2RemoteFlowController复制的描述
channelWritabilityChanged在界面
Http2RemoteFlowController
Http2Exception - 如果由于此调用而发生任何写入并遇到错误。
public void updateDependencyTree(int childStreamId,
int parentStreamId,
short weight,
boolean exclusive)
Http2RemoteFlowController
updateDependencyTree在界面
Http2RemoteFlowController
childStreamId - 与子流相关联的流标识符。
parentStreamId - 与父流关联的流标识符。
可能是0 ,使childStreamId和直接子连接。
weight - 用于parentStreamId相对于其他子流的parentStreamId 。
该值必须介于1和256(含)之间。
exclusive - 如果
childStreamId应该是
childStreamId的唯一依赖
parentStreamId 。
public void listener(Http2RemoteFlowController.Listener listener)
Http2RemoteFlowController
listener在界面
Http2RemoteFlowController
listener - 通知何时写入发生,可以是
null 。
public void incrementWindowSize(Http2Stream stream, int delta) throws Http2Exception
Http2FlowController
在Http2RemoteFlowController的情况下,在从远程端点收到WINDOW_UPDATE帧时调用该帧,以反映窗口大小的变化。
对于Http2LocalFlowController,可以调用它来请求扩展此端点发布的窗口大小。 但是,实际上,实际发送WINDOW_UPDATE时间。
incrementWindowSize ,界面
Http2FlowController
stream - 主题流。
使用Http2Connection.connectionStream()来请求连接窗口的大小。
delta - 流量控制窗口大小的变化。
Http2Exception - 如果发生与协议有关的错误,则抛出。
public void addFlowControlled(Http2Stream stream, Http2RemoteFlowController.FlowControlled frame)
Http2RemoteFlowController
除非调用Http2RemoteFlowController.writePendingBytes(),否则写入不会实际发生。
addFlowControlled在界面
Http2RemoteFlowController
stream - 主题流。
一定不能是连接流对象。
frame - 按流量控制会计和订购规则进行编写的有效负载。
public boolean hasFlowControlled(Http2Stream stream)
Http2RemoteFlowController
stream是否有任何Http2RemoteFlowController.FlowControlled当前排队的帧。
hasFlowControlled在界面
Http2RemoteFlowController
stream - 流检查是否有流量控制帧。
true如果stream有任何Http2RemoteFlowController.FlowControlled帧当前排队。
public void writePendingBytes()
throws Http2Exception
Http2RemoteFlowController
writePendingBytes ,界面
Http2RemoteFlowController
Http2Exception - 如果发生协议相关错误则抛出。
Copyright © 2008–2018 The Netty Project. All rights reserved.