Top Description Inners Fields Constructors Methods
io.netty.handler.codec.http2

public Class DefaultHttp2LocalFlowController

extends Object
implements Http2LocalFlowController
Class Inheritance
All Implemented Interfaces
io.netty.handler.codec.http2.Http2LocalFlowController, io.netty.handler.codec.http2.Http2FlowController
Annotations
@UnstableApi
Static Imports
io.netty.handler.codec.http2.Http2CodecUtil.CONNECTION_STREAM_ID, .Http2CodecUtil.DEFAULT_WINDOW_SIZE, .Http2CodecUtil.MAX_INITIAL_WINDOW_SIZE, .Http2CodecUtil.MIN_INITIAL_WINDOW_SIZE, .Http2Error.FLOW_CONTROL_ERROR, .Http2Error.INTERNAL_ERROR, .Http2Exception.connectionError, .Http2Exception.streamError, io.netty.util.internal.ObjectUtil.checkNotNull, .ObjectUtil.checkPositiveOrZero, java.lang.Math.max, .Math.min

Basic implementation of Http2LocalFlowController.

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
DefaultHttp2LocalFlowController.AutoRefillState

Flow control state that does autorefill of the flow control window when the data is received.

private class
DefaultHttp2LocalFlowController.DefaultState

Flow control window state for an individual stream.

private static interface
DefaultHttp2LocalFlowController.FlowState

An abstraction which provides specific extensions used by local flow control.

private class
DefaultHttp2LocalFlowController.WindowUpdateVisitor

Provides a means to iterate over all active streams and increment the flow control windows.

Field Summary

Modifier and TypeField and Description
private final Http2Connection
private ChannelHandlerContext
public static final float
DEFAULT_WINDOW_UPDATE_RATIO

The default ratio of window size to initial window size below which a WINDOW_UPDATE is sent to expand the window.

private Http2FrameWriter
private int
private static final DefaultHttp2LocalFlowController.FlowState
REDUCED_FLOW_STATE

The local flow control state for a single stream that is not in a state where flow controlled frames cannot be exchanged.

private final Http2Connection.PropertyKey
private float

Constructor Summary

AccessConstructor and Description
public
public
DefaultHttp2LocalFlowController(Http2Connection
the connection state.
connection
,
float
the window percentage below which to send a WINDOW_UPDATE.
windowUpdateRatio
,
boolean
if true, effectively disables the connection window in the flow control algorithm as they will always refill automatically without requiring the application to consume the bytes. When enabled, the maximum bytes you must be prepared to queue is proportional to maximum number of concurrent streams * the initial window size per stream (SETTINGS_MAX_CONCURRENT_STREAMS SETTINGS_INITIAL_WINDOW_SIZE).
autoRefillConnectionWindow
)

Constructs a controller with the given settings.

Method Summary

Modifier and TypeMethod and Description
public void
channelHandlerContext(ChannelHandlerContext
The ChannelHandlerContext for which to apply flow control on.
ctx
)

Implements io.netty.handler.codec.http2.Http2FlowController.channelHandlerContext.

Set the ChannelHandlerContext for which to apply flow control on.
private static void
checkValidRatio(float ratio)

private DefaultHttp2LocalFlowController.FlowState
private boolean
public boolean
consumeBytes(Http2Stream
the stream for which window space should be freed. The connection stream object must not be used. If stream is null or closed (i.e. Http2Stream#state() method returns Http2Stream.State#CLOSED), calling this method has no effect.
stream
,
int
the number of bytes to be returned to the flow control window.
numBytes
)

Implements io.netty.handler.codec.http2.Http2LocalFlowController.consumeBytes.

Indicates that the application has consumed a number of bytes for the given stream and is therefore ready to receive more data from the remote endpoint.
public DefaultHttp2LocalFlowController
frameWriter(Http2FrameWriter
the HTTP/2 frame writer.
frameWriter
)

Implements io.netty.handler.codec.http2.Http2LocalFlowController.frameWriter.

Sets the writer to be use for sending WINDOW_UPDATE frames.
public void
incrementWindowSize(Http2Stream
The subject stream. Use Http2Connection#connectionStream() for requesting the size of the connection window.
stream
,
int
the change in size of the flow control window.
delta
)

Implements io.netty.handler.codec.http2.Http2FlowController.incrementWindowSize.

Increments the size of the stream's flow control window by the given delta.
public void
initialWindowSize(int
the new initial window size.
newWindowSize
)

Implements io.netty.handler.codec.http2.Http2FlowController.initialWindowSize.

Sets the connection-wide initial flow control window and updates all stream windows (but not the connection stream window) by the delta.
public int
initialWindowSize()

Implements io.netty.handler.codec.http2.Http2FlowController.initialWindowSize.

Gets the connection-wide initial flow control window size that is used as the basis for new stream flow control windows.
public int
initialWindowSize(Http2Stream stream)

Implements io.netty.handler.codec.http2.Http2LocalFlowController.initialWindowSize.

Get the initial flow control window size for the given stream.
private static boolean
public void
receiveFlowControlledFrame(Http2Stream
the subject stream for the received frame. The connection stream object must not be used. If stream is null or closed, flow control should only be applied to the connection window and the bytes are immediately consumed.
stream
,
ByteBuf
payload buffer for the frame.
data
,
int
additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
padding
,
boolean
Indicates whether this is the last frame to be sent from the remote endpoint for this stream.
endOfStream
)

Implements io.netty.handler.codec.http2.Http2LocalFlowController.receiveFlowControlledFrame.

Receives an inbound DATA frame from the remote endpoint and applies flow control policies to it for both the stream as well as the connection.
private DefaultHttp2LocalFlowController.FlowState
public int
unconsumedBytes(Http2Stream
the stream for which window space should be freed.
stream
)

Implements io.netty.handler.codec.http2.Http2LocalFlowController.unconsumedBytes.

The number of bytes for the given stream that have been received but not yet consumed by the application.
public int
windowSize(Http2Stream stream)

Implements io.netty.handler.codec.http2.Http2FlowController.windowSize.

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.
public void
windowUpdateRatio(float
the ratio to use when checking if a WINDOW_UPDATE is determined necessary for new streams.
ratio
)

The window update ratio is used to determine when a window update must be sent.

public float
windowUpdateRatio()

The window update ratio is used to determine when a window update must be sent.

public void
windowUpdateRatio(Http2Stream
the stream for which ratio applies to.
stream
,
float
the ratio to use when checking if a WINDOW_UPDATE is determined necessary.
ratio
)

The window update ratio is used to determine when a window update must be sent.

public float
windowUpdateRatio(Http2Stream stream)

The window update ratio is used to determine when a window update must be sent.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connectionback to summary
private final Http2Connection connection
ctxback to summary
private ChannelHandlerContext ctx
DEFAULT_WINDOW_UPDATE_RATIOback to summary
public static final float DEFAULT_WINDOW_UPDATE_RATIO

The default ratio of window size to initial window size below which a WINDOW_UPDATE is sent to expand the window.

frameWriterback to summary
private Http2FrameWriter frameWriter
initialWindowSizeback to summary
private int initialWindowSize
REDUCED_FLOW_STATEback to summary
private static final DefaultHttp2LocalFlowController.FlowState REDUCED_FLOW_STATE

The local flow control state for a single stream that is not in a state where flow controlled frames cannot be exchanged.

stateKeyback to summary
private final Http2Connection.PropertyKey stateKey
windowUpdateRatioback to summary
private float windowUpdateRatio

Constructor Detail

DefaultHttp2LocalFlowControllerback to summary
public DefaultHttp2LocalFlowController(Http2Connection connection)
DefaultHttp2LocalFlowControllerback to summary
public DefaultHttp2LocalFlowController(Http2Connection connection, float windowUpdateRatio, boolean autoRefillConnectionWindow)

Constructs a controller with the given settings.

Parameters
connection:Http2Connection

the connection state.

windowUpdateRatio:float

the window percentage below which to send a WINDOW_UPDATE.

autoRefillConnectionWindow:boolean

if true, effectively disables the connection window in the flow control algorithm as they will always refill automatically without requiring the application to consume the bytes. When enabled, the maximum bytes you must be prepared to queue is proportional to maximum number of concurrent streams * the initial window size per stream (SETTINGS_MAX_CONCURRENT_STREAMS SETTINGS_INITIAL_WINDOW_SIZE).

Method Detail

channelHandlerContextback to summary
public void channelHandlerContext(ChannelHandlerContext ctx)

Implements io.netty.handler.codec.http2.Http2FlowController.channelHandlerContext.

Doc from io.netty.handler.codec.http2.Http2FlowController.channelHandlerContext.

Set the 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.

Parameters
ctx:ChannelHandlerContext

The ChannelHandlerContext for which to apply flow control on.

Annotations
@Override
checkValidRatioback to summary
private static void checkValidRatio(float ratio)
connectionStateback to summary
private DefaultHttp2LocalFlowController.FlowState connectionState()
consumeAllBytesback to summary
private boolean consumeAllBytes(DefaultHttp2LocalFlowController.FlowState state, int numBytes) throws Http2Exception
consumeBytesback to summary
public boolean consumeBytes(Http2Stream stream, int numBytes) throws Http2Exception

Implements io.netty.handler.codec.http2.Http2LocalFlowController.consumeBytes.

Doc from io.netty.handler.codec.http2.Http2LocalFlowController.consumeBytes.

Indicates that the application has consumed a number of bytes for the given stream and is therefore ready to receive more data from the remote endpoint. The application must consume any bytes that it receives or the flow control window will collapse. Consuming bytes enables the flow controller to send WINDOW_UPDATE to restore a portion of the flow control window for the stream.

If stream is null or closed (i.e. Http2Stream#state() method returns Http2Stream.State#CLOSED), calling this method has no effect.

Parameters
stream:Http2Stream

the stream for which window space should be freed. The connection stream object must not be used. If stream is null or closed (i.e. Http2Stream#state() method returns Http2Stream.State#CLOSED), calling this method has no effect.

numBytes:int

the number of bytes to be returned to the flow control window.

Returns:boolean

true if a WINDOW_UPDATE was sent, false otherwise.

Annotations
@Override
Exceptions
Http2Exception:
if the number of bytes returned exceeds the unconsumedBytes(Http2Stream) for the stream.
frameWriterback to summary
public DefaultHttp2LocalFlowController frameWriter(Http2FrameWriter frameWriter)

Implements io.netty.handler.codec.http2.Http2LocalFlowController.frameWriter.

Doc from io.netty.handler.codec.http2.Http2LocalFlowController.frameWriter.

Sets the writer to be use for sending WINDOW_UPDATE frames. This must be called before any flow controlled data is received.

Parameters
frameWriter:Http2FrameWriter

the HTTP/2 frame writer.

Annotations
@Override
incrementWindowSizeback to summary
public void incrementWindowSize(Http2Stream stream, int delta) throws Http2Exception

Implements io.netty.handler.codec.http2.Http2FlowController.incrementWindowSize.

Doc from io.netty.handler.codec.http2.Http2FlowController.incrementWindowSize.

Increments the size of the stream's flow control window by the given delta.

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.

Parameters
stream:Http2Stream

The subject stream. Use Http2Connection#connectionStream() for requesting the size of the connection window.

delta:int

the change in size of the flow control window.

Annotations
@Override
Exceptions
Http2Exception:
thrown if a protocol-related error occurred.
initialWindowSizeback to summary
public void initialWindowSize(int newWindowSize) throws Http2Exception

Implements io.netty.handler.codec.http2.Http2FlowController.initialWindowSize.

Doc from io.netty.handler.codec.http2.Http2FlowController.initialWindowSize.

Sets the connection-wide initial flow control window and updates all stream windows (but not the connection stream window) by the delta.

Represents the value for SETTINGS_INITIAL_WINDOW_SIZE. This method should only be called by Netty (not users) as a result of a receiving a SETTINGS frame.

Parameters
newWindowSize:int

the new initial window size.

Annotations
@Override
Exceptions
Http2Exception:
thrown if any protocol-related error occurred.
initialWindowSizeback to summary
public int initialWindowSize()

Implements io.netty.handler.codec.http2.Http2FlowController.initialWindowSize.

Doc from io.netty.handler.codec.http2.Http2FlowController.initialWindowSize.

Gets the connection-wide initial flow control window size that is used as the basis for new stream flow control windows.

Represents the value for SETTINGS_INITIAL_WINDOW_SIZE. The initial value returned by this method must be Http2CodecUtil#DEFAULT_WINDOW_SIZE.

Annotations
@Override
initialWindowSizeback to summary
public int initialWindowSize(Http2Stream stream)

Implements io.netty.handler.codec.http2.Http2LocalFlowController.initialWindowSize.

Doc from io.netty.handler.codec.http2.Http2LocalFlowController.initialWindowSize.

Get the initial flow control window size for the given stream. This quantity is measured in number of bytes. Note the unavailable window portion can be calculated by initialWindowSize() - windowSize(Http2Stream).

Annotations
@Override
isClosedback to summary
private static boolean isClosed(Http2Stream stream)
receiveFlowControlledFrameback to summary
public void receiveFlowControlledFrame(Http2Stream stream, ByteBuf data, int padding, boolean endOfStream) throws Http2Exception

Implements io.netty.handler.codec.http2.Http2LocalFlowController.receiveFlowControlledFrame.

Doc from io.netty.handler.codec.http2.Http2LocalFlowController.receiveFlowControlledFrame.

Receives an inbound DATA frame from the remote endpoint and applies flow control policies to it for both the stream as well as the connection. If any flow control policies have been violated, an exception is raised immediately, otherwise the frame is considered to have "passed" flow control.

If stream is null or closed, flow control should only be applied to the connection window and the bytes are immediately consumed.

Parameters
stream:Http2Stream

the subject stream for the received frame. The connection stream object must not be used. If stream is null or closed, flow control should only be applied to the connection window and the bytes are immediately consumed.

data:ByteBuf

payload buffer for the frame.

padding:int

additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).

endOfStream:boolean

Indicates whether this is the last frame to be sent from the remote endpoint for this stream.

Annotations
@Override
Exceptions
Http2Exception:
if any flow control errors are encountered.
stateback to summary
private DefaultHttp2LocalFlowController.FlowState state(Http2Stream stream)
unconsumedBytesback to summary
public int unconsumedBytes(Http2Stream stream)

Implements io.netty.handler.codec.http2.Http2LocalFlowController.unconsumedBytes.

Doc from io.netty.handler.codec.http2.Http2LocalFlowController.unconsumedBytes.

The number of bytes for the given stream that have been received but not yet consumed by the application.

Parameters
stream:Http2Stream

the stream for which window space should be freed.

Returns:int

the number of unconsumed bytes for the stream.

Annotations
@Override
windowSizeback to summary
public int windowSize(Http2Stream stream)

Implements io.netty.handler.codec.http2.Http2FlowController.windowSize.

Doc from io.netty.handler.codec.http2.Http2FlowController.windowSize.

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. This quantity is measured in number of bytes.

Annotations
@Override
windowUpdateRatioback to summary
public void windowUpdateRatio(float ratio)

The window update ratio is used to determine when a window update must be sent. If the ratio of bytes processed since the last update has meet or exceeded this ratio then a window update will be sent. This is the global window update ratio that will be used for new streams.

Parameters
ratio:float

the ratio to use when checking if a WINDOW_UPDATE is determined necessary for new streams.

Exceptions
IllegalArgumentException:
If the ratio is out of bounds (0, 1).
windowUpdateRatioback to summary
public float windowUpdateRatio()

The window update ratio is used to determine when a window update must be sent. If the ratio of bytes processed since the last update has meet or exceeded this ratio then a window update will be sent. This is the global window update ratio that will be used for new streams.

windowUpdateRatioback to summary
public void windowUpdateRatio(Http2Stream stream, float ratio) throws Http2Exception

The window update ratio is used to determine when a window update must be sent. If the ratio of bytes processed since the last update has meet or exceeded this ratio then a window update will be sent. This window update ratio will only be applied to streamId.

Note it is the responsibly of the caller to ensure that the initial SETTINGS frame is sent before this is called. It would be considered a Http2Error#PROTOCOL_ERROR if a WINDOW_UPDATE was generated by this method before the initial SETTINGS frame is sent.

Parameters
stream:Http2Stream

the stream for which ratio applies to.

ratio:float

the ratio to use when checking if a WINDOW_UPDATE is determined necessary.

Exceptions
Http2Exception:
If a protocol-error occurs while generating WINDOW_UPDATE frames
windowUpdateRatioback to summary
public float windowUpdateRatio(Http2Stream stream) throws Http2Exception

The window update ratio is used to determine when a window update must be sent. If the ratio of bytes processed since the last update has meet or exceeded this ratio then a window update will be sent. This window update ratio will only be applied to streamId.

Exceptions
Http2Exception:
If no stream corresponding to stream could be found.
io.netty.handler.codec.http2 back to summary

private final Class DefaultHttp2LocalFlowController.AutoRefillState

extends DefaultState
Class Inheritance

Flow control state that does autorefill of the flow control window when the data is received.

Constructor Summary

AccessConstructor and Description
pack-priv
AutoRefillState(Http2Stream stream, int initialWindowSize)

Method Summary

Modifier and TypeMethod and Description
public boolean
consumeBytes(int
the number of bytes to be returned to the flow control window.
numBytes
)

Overrides io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.DefaultState.consumeBytes.

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.consumeBytes.

Indicates that the application has consumed numBytes from the connection or stream and is ready to receive more data.
public void
receiveFlowControlledFrame(int
The amount of data to for which this stream is no longer eligible to use for flow control.
dataLength
)

Overrides io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.DefaultState.receiveFlowControlledFrame.

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.receiveFlowControlledFrame.

A flow control event has occurred and we should decrement the amount of available bytes for this stream.
Inherited from io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.DefaultState:
endOfStreamincrementFlowControlWindowsincrementInitialStreamWindowinitialWindowSizeunconsumedByteswindowwindowSizewindowUpdateRatiowindowUpdateRatiowriteWindowUpdateIfNeeded

Constructor Detail

AutoRefillStateback to summary
pack-priv AutoRefillState(Http2Stream stream, int initialWindowSize)

Method Detail

consumeBytesback to summary
public boolean consumeBytes(int numBytes) throws Http2Exception

Overrides io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.DefaultState.consumeBytes.

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.consumeBytes.

Doc from io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.consumeBytes.

Indicates that the application has consumed numBytes from the connection or stream and is ready to receive more data.

Parameters
numBytes:int

the number of bytes to be returned to the flow control window.

Returns:boolean

true if WINDOW_UPDATE was written, false otherwise.

Annotations
@Override
receiveFlowControlledFrameback to summary
public void receiveFlowControlledFrame(int dataLength) throws Http2Exception

Overrides io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.DefaultState.receiveFlowControlledFrame.

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.receiveFlowControlledFrame.

Doc from io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.receiveFlowControlledFrame.

A flow control event has occurred and we should decrement the amount of available bytes for this stream.

Parameters
dataLength:int

The amount of data to for which this stream is no longer eligible to use for flow control.

Annotations
@Override
Exceptions
Http2Exception:
If too much data is used relative to how much is available.
io.netty.handler.codec.http2 back to summary

private Class DefaultHttp2LocalFlowController.DefaultState

extends Object
implements FlowState
Class Inheritance
  • java.lang.Object
  • io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.DefaultState
All Implemented Interfaces
io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState
Known Direct Subclasses
io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.AutoRefillState

Flow control window state for an individual stream.

Field Summary

Modifier and TypeField and Description
private boolean
private int
initialStreamWindowSize

This is what is used to determine how many bytes need to be returned relative to processedWindow.

private int
private int
processedWindow

A view of window that is used to determine when to send WINDOW_UPDATE frames.

private final Http2Stream
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 Summary

AccessConstructor and Description
pack-priv
DefaultState(Http2Stream stream, int initialWindowSize)

Method Summary

Modifier and TypeMethod and Description
public boolean
consumeBytes(int
the number of bytes to be returned to the flow control window.
numBytes
)

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.consumeBytes.

Indicates that the application has consumed numBytes from the connection or stream and is ready to receive more data.
public void
public void
incrementFlowControlWindows(int
The amount to increment the window by.
delta
)

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.incrementFlowControlWindows.

Increment the windows which are used to determine many bytes have been processed.
public void
incrementInitialStreamWindow(int
The amount to increase the initial window size by.
delta
)

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.incrementInitialStreamWindow.

Increment the initial window size for this stream.
public int
public void
receiveFlowControlledFrame(int
The amount of data to for which this stream is no longer eligible to use for flow control.
dataLength
)

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.receiveFlowControlledFrame.

A flow control event has occurred and we should decrement the amount of available bytes for this stream.
private void
public int
public void
public int
public float
public void
private void
writeWindowUpdate()

Called to perform a window update for this stream (or connection).

public boolean
writeWindowUpdateIfNeeded()

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.writeWindowUpdateIfNeeded.

Updates the flow control window for this stream if it is appropriate.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

endOfStreamback to summary
private boolean endOfStream
initialStreamWindowSizeback to summary
private int initialStreamWindowSize

This is what is used to determine how many bytes need to be returned relative to processedWindow. Each stream has their own initial window size.

lowerBoundback to summary
private int lowerBound
processedWindowback to summary
private int processedWindow

A view of 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.

streamback to summary
private final Http2Stream stream
streamWindowUpdateRatioback to summary
private float streamWindowUpdateRatio

This is used to determine when processedWindow is sufficiently far away from initialStreamWindowSize such that a WINDOW_UPDATE should be sent. Each stream has their own window update ratio.

windowback to summary
private int window

The actual flow control window that is decremented as soon as DATA arrives.

Constructor Detail

DefaultStateback to summary
pack-priv DefaultState(Http2Stream stream, int initialWindowSize)

Method Detail

consumeBytesback to summary
public boolean consumeBytes(int numBytes) throws Http2Exception

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.consumeBytes.

Doc from io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.consumeBytes.

Indicates that the application has consumed numBytes from the connection or stream and is ready to receive more data.

Parameters
numBytes:int

the number of bytes to be returned to the flow control window.

Returns:boolean

true if WINDOW_UPDATE was written, false otherwise.

Annotations
@Override
endOfStreamback to summary
public void endOfStream(boolean endOfStream)

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.endOfStream.

Annotations
@Override
incrementFlowControlWindowsback to summary
public void incrementFlowControlWindows(int delta) throws Http2Exception

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.incrementFlowControlWindows.

Doc from io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.incrementFlowControlWindows.

Increment the windows which are used to determine many bytes have been processed.

Parameters
delta:int

The amount to increment the window by.

Annotations
@Override
Exceptions
Http2Exception:
if integer overflow occurs on the window.
incrementInitialStreamWindowback to summary
public void incrementInitialStreamWindow(int delta)

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.incrementInitialStreamWindow.

Doc from io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.incrementInitialStreamWindow.

Increment the initial window size for this stream.

Parameters
delta:int

The amount to increase the initial window size by.

Annotations
@Override
initialWindowSizeback to summary
public int initialWindowSize()

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.initialWindowSize.

Annotations
@Override
receiveFlowControlledFrameback to summary
public void receiveFlowControlledFrame(int dataLength) throws Http2Exception

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.receiveFlowControlledFrame.

Doc from io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.receiveFlowControlledFrame.

A flow control event has occurred and we should decrement the amount of available bytes for this stream.

Parameters
dataLength:int

The amount of data to for which this stream is no longer eligible to use for flow control.

Annotations
@Override
Exceptions
Http2Exception:
If too much data is used relative to how much is available.
returnProcessedBytesback to summary
private void returnProcessedBytes(int delta) throws Http2Exception
unconsumedBytesback to summary
public int unconsumedBytes()

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.unconsumedBytes.

Annotations
@Override
windowback to summary
public void window(int initialWindowSize)

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.window.

Annotations
@Override
windowSizeback to summary
public int windowSize()

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.windowSize.

Annotations
@Override
windowUpdateRatioback to summary
public float windowUpdateRatio()

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.windowUpdateRatio.

Annotations
@Override
windowUpdateRatioback to summary
public void windowUpdateRatio(float ratio)

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.windowUpdateRatio.

Annotations
@Override
writeWindowUpdateback to summary
private void writeWindowUpdate() throws Http2Exception

Called to perform a window update for this stream (or connection). Updates the window size back to the size of the initial window and sends a window update frame to the remote endpoint.

writeWindowUpdateIfNeededback to summary
public boolean writeWindowUpdateIfNeeded() throws Http2Exception

Implements io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.writeWindowUpdateIfNeeded.

Doc from io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.FlowState.writeWindowUpdateIfNeeded.

Updates the flow control window for this stream if it is appropriate.

Returns:boolean

true if WINDOW_UPDATE was written, false otherwise.

Annotations
@Override
io.netty.handler.codec.http2 back to summary

private Interface DefaultHttp2LocalFlowController.FlowState

Known Direct Implementers
io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.DefaultState

An abstraction which provides specific extensions used by local flow control.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if WINDOW_UPDATE was written, false otherwise.
consumeBytes
(int
the number of bytes to be returned to the flow control window.
numBytes
)

Indicates that the application has consumed numBytes from the connection or stream and is ready to receive more data.

public void
endOfStream(boolean endOfStream)

public void
incrementFlowControlWindows(int
The amount to increment the window by.
delta
)

Increment the windows which are used to determine many bytes have been processed.

public void
incrementInitialStreamWindow(int
The amount to increase the initial window size by.
delta
)

Increment the initial window size for this stream.

public int
public void
receiveFlowControlledFrame(int
The amount of data to for which this stream is no longer eligible to use for flow control.
dataLength
)

A flow control event has occurred and we should decrement the amount of available bytes for this stream.

public int
public void
window(int initialWindowSize)

public int
public float
public void
windowUpdateRatio(float ratio)

public boolean

Returns:

true if WINDOW_UPDATE was written, false otherwise.
writeWindowUpdateIfNeeded
()

Updates the flow control window for this stream if it is appropriate.

Method Detail

consumeBytesback to summary
public boolean consumeBytes(int numBytes) throws Http2Exception

Indicates that the application has consumed numBytes from the connection or stream and is ready to receive more data.

Parameters
numBytes:int

the number of bytes to be returned to the flow control window.

Returns:boolean

true if WINDOW_UPDATE was written, false otherwise.

endOfStreamback to summary
public void endOfStream(boolean endOfStream)
incrementFlowControlWindowsback to summary
public void incrementFlowControlWindows(int delta) throws Http2Exception

Increment the windows which are used to determine many bytes have been processed.

Parameters
delta:int

The amount to increment the window by.

Exceptions
Http2Exception:
if integer overflow occurs on the window.
incrementInitialStreamWindowback to summary
public void incrementInitialStreamWindow(int delta)

Increment the initial window size for this stream.

Parameters
delta:int

The amount to increase the initial window size by.

initialWindowSizeback to summary
public int initialWindowSize()
receiveFlowControlledFrameback to summary
public void receiveFlowControlledFrame(int dataLength) throws Http2Exception

A flow control event has occurred and we should decrement the amount of available bytes for this stream.

Parameters
dataLength:int

The amount of data to for which this stream is no longer eligible to use for flow control.

Exceptions
Http2Exception:
If too much data is used relative to how much is available.
unconsumedBytesback to summary
public int unconsumedBytes()
windowback to summary
public void window(int initialWindowSize)
windowSizeback to summary
public int windowSize()
windowUpdateRatioback to summary
public float windowUpdateRatio()
windowUpdateRatioback to summary
public void windowUpdateRatio(float ratio)
writeWindowUpdateIfNeededback to summary
public boolean writeWindowUpdateIfNeeded() throws Http2Exception

Updates the flow control window for this stream if it is appropriate.

Returns:boolean

true if WINDOW_UPDATE was written, false otherwise.

io.netty.handler.codec.http2 back to summary

private final Class DefaultHttp2LocalFlowController.WindowUpdateVisitor

extends Object
implements Http2StreamVisitor
Class Inheritance
  • java.lang.Object
  • io.netty.handler.codec.http2.DefaultHttp2LocalFlowController.WindowUpdateVisitor
All Implemented Interfaces
io.netty.handler.codec.http2.Http2StreamVisitor

Provides a means to iterate over all active streams and increment the flow control windows.

Field Summary

Modifier and TypeField and Description
private Http2Exception.CompositeStreamException
private final int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

compositeExceptionback to summary
private Http2Exception.CompositeStreamException compositeException
deltaback to summary
private final int delta

Constructor Detail

WindowUpdateVisitorback to summary
pack-priv WindowUpdateVisitor(int delta)

Method Detail

throwIfErrorback to summary
public void throwIfError() throws CompositeStreamException
visitback to summary
public boolean visit(Http2Stream stream) throws Http2Exception

Implements io.netty.handler.codec.http2.Http2StreamVisitor.visit.

Returns:boolean

Doc from io.netty.handler.codec.http2.Http2StreamVisitor.visit.

  • true if the visitor wants to continue the loop and handle the entry.
  • false if the visitor wants to stop handling headers and abort the loop.
Annotations
@Override