private class DefaultHttp2LocalFlowController.DefaultState extends java.lang.Object implements DefaultHttp2LocalFlowController.FlowState
| Modifier and Type | Field and Description |
|---|---|
private boolean |
endOfStream |
private int |
initialStreamWindowSize
This is what is used to determine how many bytes need to be returned relative to
processedWindow. |
private int |
lowerBound |
private int |
processedWindow
A view of
window that is used to determine when to send WINDOW_UPDATE
frames. |
private Http2Stream |
stream |
private float |
streamWindowUpdateRatio
This is used to determine when
processedWindow is sufficiently far away from
initialStreamWindowSize such that a WINDOW_UPDATE should be sent. |
private int |
window
The actual flow control window that is decremented as soon as
DATA arrives. |
| Constructor and Description |
|---|
DefaultState(Http2Stream stream,
int initialWindowSize) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
consumeBytes(int numBytes)
Indicates that the application has consumed
numBytes from the connection or stream and is
ready to receive more data. |
void |
endOfStream(boolean endOfStream) |
void |
incrementFlowControlWindows(int delta)
Increment the windows which are used to determine many bytes have been processed.
|
void |
incrementInitialStreamWindow(int delta)
Increment the initial window size for this stream.
|
int |
initialWindowSize() |
void |
receiveFlowControlledFrame(int dataLength)
A flow control event has occurred and we should decrement the amount of available bytes for this stream.
|
private void |
returnProcessedBytes(int delta) |
int |
unconsumedBytes() |
void |
window(int initialWindowSize) |
int |
windowSize() |
float |
windowUpdateRatio() |
void |
windowUpdateRatio(float ratio) |
private void |
writeWindowUpdate()
Called to perform a window update for this stream (or connection).
|
boolean |
writeWindowUpdateIfNeeded()
Updates the flow control window for this stream if it is appropriate.
|
private final Http2Stream stream
private int window
DATA arrives.private int processedWindow
window that is used to determine when to send WINDOW_UPDATE
frames. Decrementing this window for received DATA frames is delayed until the
application has indicated that the data has been fully processed. This prevents sending
a WINDOW_UPDATE until the number of processed bytes drops below the threshold.private int initialStreamWindowSize
processedWindow.
Each stream has their own initial window size.private float streamWindowUpdateRatio
processedWindow is sufficiently far away from
initialStreamWindowSize such that a WINDOW_UPDATE should be sent.
Each stream has their own window update ratio.private int lowerBound
private boolean endOfStream
public DefaultState(Http2Stream stream, int initialWindowSize)
public void window(int initialWindowSize)
window in interface DefaultHttp2LocalFlowController.FlowStatepublic int windowSize()
windowSize in interface DefaultHttp2LocalFlowController.FlowStatepublic int initialWindowSize()
initialWindowSize in interface DefaultHttp2LocalFlowController.FlowStatepublic void endOfStream(boolean endOfStream)
endOfStream in interface DefaultHttp2LocalFlowController.FlowStatepublic float windowUpdateRatio()
windowUpdateRatio in interface DefaultHttp2LocalFlowController.FlowStatepublic void windowUpdateRatio(float ratio)
windowUpdateRatio in interface DefaultHttp2LocalFlowController.FlowStatepublic void incrementInitialStreamWindow(int delta)
DefaultHttp2LocalFlowController.FlowStateincrementInitialStreamWindow in interface DefaultHttp2LocalFlowController.FlowStatedelta - The amount to increase the initial window size by.public void incrementFlowControlWindows(int delta)
throws Http2Exception
DefaultHttp2LocalFlowController.FlowStateincrementFlowControlWindows in interface DefaultHttp2LocalFlowController.FlowStatedelta - The amount to increment the window by.Http2Exception - if integer overflow occurs on the window.public void receiveFlowControlledFrame(int dataLength)
throws Http2Exception
DefaultHttp2LocalFlowController.FlowStatereceiveFlowControlledFrame in interface DefaultHttp2LocalFlowController.FlowStatedataLength - The amount of data to for which this stream is no longer eligible to use for flow control.Http2Exception - If too much data is used relative to how much is available.private void returnProcessedBytes(int delta)
throws Http2Exception
Http2Exceptionpublic boolean consumeBytes(int numBytes)
throws Http2Exception
DefaultHttp2LocalFlowController.FlowStatenumBytes from the connection or stream and is
ready to receive more data.consumeBytes in interface DefaultHttp2LocalFlowController.FlowStatenumBytes - the number of bytes to be returned to the flow control window.WINDOW_UPDATE was written, false otherwise.Http2Exceptionpublic int unconsumedBytes()
unconsumedBytes in interface DefaultHttp2LocalFlowController.FlowStatepublic boolean writeWindowUpdateIfNeeded()
throws Http2Exception
DefaultHttp2LocalFlowController.FlowStatewriteWindowUpdateIfNeeded in interface DefaultHttp2LocalFlowController.FlowStateWINDOW_UPDATE was written, false otherwise.Http2Exceptionprivate void writeWindowUpdate()
throws Http2Exception
Http2Exception