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

public Class DefaultHttp2RemoteFlowController

extends Object
implements Http2RemoteFlowController
Class Inheritance
All Implemented Interfaces
io.netty.handler.codec.http2.Http2RemoteFlowController, io.netty.handler.codec.http2.Http2FlowController
Annotations
@UnstableApi
Imports
io.netty.channel.ChannelHandlerContext, io.netty.util.internal.UnstableApi, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.util.ArrayDeque, .Deque

Basic implementation of 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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
DefaultHttp2RemoteFlowController.FlowState

The remote flow control state for a single stream.

private class
DefaultHttp2RemoteFlowController.ListenerWritabilityMonitor

Writability of a stream is calculated using the following:

Connection Window - Total Queued Bytes > 0 &&
Stream Window - Bytes Queued for Stream > 0 &&
isChannelWritable()
private class
DefaultHttp2RemoteFlowController.WritabilityMonitor

Abstract class which provides common functionality for writability monitor implementations.

Field Summary

Modifier and TypeField and Description
private final Http2Connection
private final DefaultHttp2RemoteFlowController.FlowState
private ChannelHandlerContext
private int
private static final InternalLogger
private static final int
private DefaultHttp2RemoteFlowController.WritabilityMonitor
private final Http2Connection.PropertyKey
private final StreamByteDistributor

Constructor Summary

AccessConstructor and Description
public
public
public
public

Method Summary

Modifier and TypeMethod and Description
public void
addFlowControlled(Http2Stream
the subject stream. Must not be the connection stream object.
stream
,
Http2RemoteFlowController.FlowControlled
payload to write subject to flow-control accounting and ordering rules.
frame
)

Implements io.netty.handler.codec.http2.Http2RemoteFlowController.addFlowControlled.

Queues a payload for transmission to the remote endpoint.
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.
public ChannelHandlerContext
public void
private int
connectionWindowSize()

Returns the flow control window for the entire connection.

public boolean
hasFlowControlled(Http2Stream
the stream to check if it has flow controlled frames.
stream
)

Implements io.netty.handler.codec.http2.Http2RemoteFlowController.hasFlowControlled.

Determine if stream has any FlowControlled frames currently queued.
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.
private boolean
private boolean
public boolean
isWritable(Http2Stream
The stream to test.
stream
)

Implements io.netty.handler.codec.http2.Http2RemoteFlowController.isWritable.

Determine if the stream has bytes remaining for use in the flow control window.
public void
listener(Http2RemoteFlowController.Listener
to notify when the a write occurs, can be null.
listener
)

Implements io.netty.handler.codec.http2.Http2RemoteFlowController.listener.

Set the active listener on the flow-controller.
private int
private int
private DefaultHttp2RemoteFlowController.FlowState
public void
updateDependencyTree(int
The stream identifier associated with the child stream.
childStreamId
,
int
The stream identifier associated with the parent stream. May be 0, to make childStreamId and immediate child of the connection.
parentStreamId
,
short
The weight which is used relative to other child streams for parentStreamId. This value must be between 1 and 256 (inclusive).
weight
,
boolean
If childStreamId should be the exclusive dependency of parentStreamId.
exclusive
)

Implements io.netty.handler.codec.http2.Http2RemoteFlowController.updateDependencyTree.

Explicitly update the dependency tree.
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.
private int
writableBytes()

The amount of bytes that can be supported by underlying io.netty.channel.Channel without queuing "too-much".

public void
writePendingBytes()

Implements io.netty.handler.codec.http2.Http2RemoteFlowController.writePendingBytes.

Write all data pending in the flow controller up to the flow-control limits.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait