public class DefaultHttp2RemoteFlowController extends Object implements Http2RemoteFlowController
Http2RemoteFlowController.
This class is NOT thread safe. The assumption is all methods must be invoked from a single thread.
Typically this thread is the event loop thread for the ChannelHandlerContext managed by this class.
Http2RemoteFlowController.FlowControlled, Http2RemoteFlowController.Listener| Constructor and Description |
|---|
DefaultHttp2RemoteFlowController(Http2Connection connection) |
| Modifier and Type | Method and Description |
|---|---|
void |
addFlowControlled(Http2Stream stream,
Http2RemoteFlowController.FlowControlled frame)
Queues a payload for transmission to the remote endpoint.
|
ChannelHandlerContext |
channelHandlerContext()
Get the
ChannelHandlerContext for which to apply flow control on. |
void |
channelHandlerContext(ChannelHandlerContext ctx)
Set the
ChannelHandlerContext for which to apply flow control on. |
void |
incrementWindowSize(Http2Stream stream,
int delta)
Increments the size of the stream's flow control window by the given delta.
|
int |
initialWindowSize()
Gets the connection-wide initial flow control window size that is used as the basis for new stream flow
control windows.
|
int |
initialWindowSize(Http2Stream stream)
Get the initial flow control window size for the given stream.
|
void |
initialWindowSize(int newWindowSize)
Sets the connection-wide initial flow control window and updates all stream windows (but not the connection
stream window) by the delta.
|
Http2RemoteFlowController.Listener |
listener()
Get the current listener to flow-control events.
|
void |
listener(Http2RemoteFlowController.Listener listener)
Set the active listener on the flow-controller.
|
int |
windowSize(Http2Stream stream)
Get the portion of the flow control window for the given stream that is currently available for sending/receiving
frames which are subject to flow control.
|
void |
writePendingBytes()
Writes as many pending bytes as possible, according to stream priority.
|
public DefaultHttp2RemoteFlowController(Http2Connection connection)
public void channelHandlerContext(ChannelHandlerContext ctx) throws Http2Exception
ChannelHandlerContext for which to apply flow control on.
This must be called to properly initialize the Http2FlowController.
Not calling this is considered a programming error.
Any queued FlowControlled objects will be sent.
channelHandlerContext in interface Http2FlowControllerctx - The ChannelHandlerContext for which to apply flow control on.Http2Exception - if any protocol-related error occurred.public ChannelHandlerContext channelHandlerContext()
Http2RemoteFlowControllerChannelHandlerContext for which to apply flow control on.
This is intended for us by Http2RemoteFlowController.FlowControlled implementations only. Use with caution.
channelHandlerContext in interface Http2RemoteFlowControllerChannelHandlerContext for which to apply flow control on.public void initialWindowSize(int newWindowSize)
throws Http2Exception
Http2FlowController
This method is used to apply the SETTINGS_INITIAL_WINDOW_SIZE value for an
SETTINGS frame.
initialWindowSize in interface Http2FlowControllernewWindowSize - the new initial window size.Http2Exception - thrown if any protocol-related error occurred.public int initialWindowSize()
Http2FlowControllerinitialWindowSize in interface Http2FlowControllerpublic int windowSize(Http2Stream stream)
Http2FlowControllerwindowSize in interface Http2FlowControllerpublic int initialWindowSize(Http2Stream stream)
Http2FlowControllerHttp2FlowController.initialWindowSize() - Http2FlowController.windowSize(Http2Stream).initialWindowSize in interface Http2FlowControllerpublic void incrementWindowSize(Http2Stream stream, int delta) throws Http2Exception
Http2FlowController
In the case of a Http2RemoteFlowController this is called upon receipt of a
WINDOW_UPDATE frame from the remote endpoint to mirror the changes to the window
size.
For a Http2LocalFlowController this can be called to request the expansion of the
window size published by this endpoint. It is up to the implementation, however, as to when a
WINDOW_UPDATE is actually sent.
incrementWindowSize in interface Http2FlowControllerstream - The subject stream. Use Http2Connection.connectionStream() for
requesting the size of the connection window.delta - the change in size of the flow control window.Http2Exception - thrown if a protocol-related error occurred.public void listener(Http2RemoteFlowController.Listener listener)
Http2RemoteFlowControllerlistener in interface Http2RemoteFlowControllerlistener - to notify when the a write occurs, can be null.public Http2RemoteFlowController.Listener listener()
Http2RemoteFlowControllerlistener in interface Http2RemoteFlowControllernull if one is not set.public void addFlowControlled(Http2Stream stream, Http2RemoteFlowController.FlowControlled frame)
Http2RemoteFlowController
Writes do not actually occur until Http2RemoteFlowController.writePendingBytes() is called.
addFlowControlled in interface Http2RemoteFlowControllerstream - the subject stream. Must not be the connection stream object.frame - payload to write subject to flow-control accounting and ordering rules.public void writePendingBytes()
throws Http2Exception
writePendingBytes in interface Http2RemoteFlowControllerHttp2Exception - throws if a protocol-related error occurred.Copyright © 2008–2015 The Netty Project. All rights reserved.