DefaultHttp2RemoteFlowController Class — netty Architecture
Architecture documentation for the DefaultHttp2RemoteFlowController class in DefaultHttp2RemoteFlowController.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 415966d7_2c19_58a9_659f_282cc732e73c["DefaultHttp2RemoteFlowController"] 387ab0e0_5536_b5a6_dd1e_6048c918e522["DefaultHttp2RemoteFlowController.java"] 415966d7_2c19_58a9_659f_282cc732e73c -->|defined in| 387ab0e0_5536_b5a6_dd1e_6048c918e522 580fd994_c3d5_2237_e59c_286ec9432b45["DefaultHttp2RemoteFlowController()"] 415966d7_2c19_58a9_659f_282cc732e73c -->|method| 580fd994_c3d5_2237_e59c_286ec9432b45 ba7fb81e_9d0a_6793_66e0_9c7e8889da1a["channelHandlerContext()"] 415966d7_2c19_58a9_659f_282cc732e73c -->|method| ba7fb81e_9d0a_6793_66e0_9c7e8889da1a 0622aa0e_fd9b_0017_797b_b4ab239097f0["ChannelHandlerContext()"] 415966d7_2c19_58a9_659f_282cc732e73c -->|method| 0622aa0e_fd9b_0017_797b_b4ab239097f0 54fb3605_e31c_9270_8325_8b86d27689a6["initialWindowSize()"] 415966d7_2c19_58a9_659f_282cc732e73c -->|method| 54fb3605_e31c_9270_8325_8b86d27689a6 7a19e5af_cd64_43b8_9e5a_5f9f20b28c91["windowSize()"] 415966d7_2c19_58a9_659f_282cc732e73c -->|method| 7a19e5af_cd64_43b8_9e5a_5f9f20b28c91 79e36cb3_72a9_401e_b40c_3f9b60a10269["isWritable()"] 415966d7_2c19_58a9_659f_282cc732e73c -->|method| 79e36cb3_72a9_401e_b40c_3f9b60a10269 837bf35b_6f8a_e7b9_1a64_6f945891016d["channelWritabilityChanged()"] 415966d7_2c19_58a9_659f_282cc732e73c -->|method| 837bf35b_6f8a_e7b9_1a64_6f945891016d 13a81f45_ce85_83d1_7203_daf1019845c9["updateDependencyTree()"] 415966d7_2c19_58a9_659f_282cc732e73c -->|method| 13a81f45_ce85_83d1_7203_daf1019845c9 83a67fd1_f569_c827_44d6_d6628e2fb4fc["isChannelWritable()"] 415966d7_2c19_58a9_659f_282cc732e73c -->|method| 83a67fd1_f569_c827_44d6_d6628e2fb4fc 1cd8a8f6_03dd_3223_8eab_30f7f01b261c["isChannelWritable0()"] 415966d7_2c19_58a9_659f_282cc732e73c -->|method| 1cd8a8f6_03dd_3223_8eab_30f7f01b261c 9a5e2b1f_262b_8529_9e91_ff8cbeb76d87["listener()"] 415966d7_2c19_58a9_659f_282cc732e73c -->|method| 9a5e2b1f_262b_8529_9e91_ff8cbeb76d87 2fd48e31_235b_a44b_2cc6_1ebbeb6ba04f["incrementWindowSize()"] 415966d7_2c19_58a9_659f_282cc732e73c -->|method| 2fd48e31_235b_a44b_2cc6_1ebbeb6ba04f 1e16e1a0_ef04_fd1d_76cb_cdbaab5d69a7["addFlowControlled()"] 415966d7_2c19_58a9_659f_282cc732e73c -->|method| 1e16e1a0_ef04_fd1d_76cb_cdbaab5d69a7
Relationship Graph
Source Code
codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2RemoteFlowController.java lines 43–767
public class DefaultHttp2RemoteFlowController implements Http2RemoteFlowController {
private static final InternalLogger logger =
InternalLoggerFactory.getInstance(DefaultHttp2RemoteFlowController.class);
private static final int MIN_WRITABLE_CHUNK = 32 * 1024;
private final Http2Connection connection;
private final Http2Connection.PropertyKey stateKey;
private final StreamByteDistributor streamByteDistributor;
private final FlowState connectionState;
private int initialWindowSize = DEFAULT_WINDOW_SIZE;
private WritabilityMonitor monitor;
private ChannelHandlerContext ctx;
public DefaultHttp2RemoteFlowController(Http2Connection connection) {
this(connection, (Listener) null);
}
public DefaultHttp2RemoteFlowController(Http2Connection connection,
StreamByteDistributor streamByteDistributor) {
this(connection, streamByteDistributor, null);
}
public DefaultHttp2RemoteFlowController(Http2Connection connection, final Listener listener) {
this(connection, new WeightedFairQueueByteDistributor(connection), listener);
}
public DefaultHttp2RemoteFlowController(Http2Connection connection,
StreamByteDistributor streamByteDistributor,
final Listener listener) {
this.connection = checkNotNull(connection, "connection");
this.streamByteDistributor = checkNotNull(streamByteDistributor, "streamWriteDistributor");
// Add a flow state for the connection.
stateKey = connection.newKey();
connectionState = new FlowState(connection.connectionStream());
connection.connectionStream().setProperty(stateKey, connectionState);
// Monitor may depend upon connectionState, and so initialize after connectionState
listener(listener);
monitor.windowSize(connectionState, initialWindowSize);
// Register for notification of new streams.
connection.addListener(new Http2ConnectionAdapter() {
@Override
public void onStreamAdded(Http2Stream stream) {
// If the stream state is not open then the stream is not yet eligible for flow controlled frames and
// only requires the ReducedFlowState. Otherwise the full amount of memory is required.
stream.setProperty(stateKey, new FlowState(stream));
}
@Override
public void onStreamActive(Http2Stream stream) {
// If the object was previously created, but later activated then we have to ensure the proper
// initialWindowSize is used.
monitor.windowSize(state(stream), initialWindowSize);
}
@Override
public void onStreamClosed(Http2Stream stream) {
// Any pending frames can never be written, cancel and
// write errors for any pending frames.
state(stream).cancel(STREAM_CLOSED, null);
}
@Override
public void onStreamHalfClosed(Http2Stream stream) {
if (HALF_CLOSED_LOCAL == stream.state()) {
/*
* When this method is called there should not be any
* pending frames left if the API is used correctly. However,
* it is possible that a erroneous application can sneak
* in a frame even after having already written a frame with the
* END_STREAM flag set, as the stream state might not transition
* immediately to HALF_CLOSED_LOCAL / CLOSED due to flow control
* delaying the write.
*
* This is to cancel any such illegal writes.
*/
state(stream).cancel(STREAM_CLOSED, null);
}
}
});
Defined In
Source
Frequently Asked Questions
What is the DefaultHttp2RemoteFlowController class?
DefaultHttp2RemoteFlowController is a class in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2RemoteFlowController.java.
Where is DefaultHttp2RemoteFlowController defined?
DefaultHttp2RemoteFlowController is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2RemoteFlowController.java at line 43.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free