ListenerWritabilityMonitor Class — netty Architecture
Architecture documentation for the ListenerWritabilityMonitor class in DefaultHttp2RemoteFlowController.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 3dadf6c6_c839_608f_accc_8c9408feae6d["ListenerWritabilityMonitor"] 387ab0e0_5536_b5a6_dd1e_6048c918e522["DefaultHttp2RemoteFlowController.java"] 3dadf6c6_c839_608f_accc_8c9408feae6d -->|defined in| 387ab0e0_5536_b5a6_dd1e_6048c918e522 06d26692_1af2_4769_3f00_192324f8c946["ListenerWritabilityMonitor()"] 3dadf6c6_c839_608f_accc_8c9408feae6d -->|method| 06d26692_1af2_4769_3f00_192324f8c946 f4481c02_b39e_6955_b587_9b592b23fdc8["visit()"] 3dadf6c6_c839_608f_accc_8c9408feae6d -->|method| f4481c02_b39e_6955_b587_9b592b23fdc8 bbe4cf95_6ccc_abfa_09bb_4688c0dc7862["windowSize()"] 3dadf6c6_c839_608f_accc_8c9408feae6d -->|method| bbe4cf95_6ccc_abfa_09bb_4688c0dc7862 291683d3_c4d0_0a0c_9e9a_94753d57c3a2["incrementWindowSize()"] 3dadf6c6_c839_608f_accc_8c9408feae6d -->|method| 291683d3_c4d0_0a0c_9e9a_94753d57c3a2 70f98aaa_d88c_9c64_6989_6eebed973749["initialWindowSize()"] 3dadf6c6_c839_608f_accc_8c9408feae6d -->|method| 70f98aaa_d88c_9c64_6989_6eebed973749 f0e6edb9_3447_b465_6d76_673893b51c9e["enqueueFrame()"] 3dadf6c6_c839_608f_accc_8c9408feae6d -->|method| f0e6edb9_3447_b465_6d76_673893b51c9e 90c24d6b_445a_62ca_7773_89a8a9a3ff01["stateCancelled()"] 3dadf6c6_c839_608f_accc_8c9408feae6d -->|method| 90c24d6b_445a_62ca_7773_89a8a9a3ff01 74935452_d038_6cd3_ff2f_6eeeb8b0c749["channelWritabilityChange()"] 3dadf6c6_c839_608f_accc_8c9408feae6d -->|method| 74935452_d038_6cd3_ff2f_6eeeb8b0c749 397a27f4_ac2e_d522_f1f5_53b8be7d676f["checkStateWritability()"] 3dadf6c6_c839_608f_accc_8c9408feae6d -->|method| 397a27f4_ac2e_d522_f1f5_53b8be7d676f 7b2534e4_9937_1795_0633_f16f0a9d0171["notifyWritabilityChanged()"] 3dadf6c6_c839_608f_accc_8c9408feae6d -->|method| 7b2534e4_9937_1795_0633_f16f0a9d0171 b7b92d74_a107_0e16_0336_f1ebdfbd2ff3["checkConnectionThenStreamWritabilityChanged()"] 3dadf6c6_c839_608f_accc_8c9408feae6d -->|method| b7b92d74_a107_0e16_0336_f1ebdfbd2ff3 e25c5ef3_f83a_4eaa_44cb_7f7e86d06ebd["checkAllWritabilityChanged()"] 3dadf6c6_c839_608f_accc_8c9408feae6d -->|method| e25c5ef3_f83a_4eaa_44cb_7f7e86d06ebd
Relationship Graph
Source Code
codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2RemoteFlowController.java lines 668–766
private final class ListenerWritabilityMonitor extends WritabilityMonitor implements Http2StreamVisitor {
private final Listener listener;
ListenerWritabilityMonitor(Listener listener) {
this.listener = listener;
}
@Override
public boolean visit(Http2Stream stream) throws Http2Exception {
FlowState state = state(stream);
if (isWritable(state) != state.markedWritability()) {
notifyWritabilityChanged(state);
}
return true;
}
@Override
void windowSize(FlowState state, int initialWindowSize) {
super.windowSize(state, initialWindowSize);
try {
checkStateWritability(state);
} catch (Http2Exception e) {
throw new RuntimeException("Caught unexpected exception from window", e);
}
}
@Override
void incrementWindowSize(FlowState state, int delta) throws Http2Exception {
super.incrementWindowSize(state, delta);
checkStateWritability(state);
}
@Override
void initialWindowSize(int newWindowSize) throws Http2Exception {
super.initialWindowSize(newWindowSize);
if (isWritableConnection()) {
// If the write operation does not occur we still need to check all streams because they
// may have transitioned from writable to not writable.
checkAllWritabilityChanged();
}
}
@Override
void enqueueFrame(FlowState state, FlowControlled frame) throws Http2Exception {
super.enqueueFrame(state, frame);
checkConnectionThenStreamWritabilityChanged(state);
}
@Override
void stateCancelled(FlowState state) {
try {
checkConnectionThenStreamWritabilityChanged(state);
} catch (Http2Exception e) {
throw new RuntimeException("Caught unexpected exception from checkAllWritabilityChanged", e);
}
}
@Override
void channelWritabilityChange() throws Http2Exception {
if (connectionState.markedWritability() != isChannelWritable()) {
checkAllWritabilityChanged();
}
}
private void checkStateWritability(FlowState state) throws Http2Exception {
if (isWritable(state) != state.markedWritability()) {
if (state == connectionState) {
checkAllWritabilityChanged();
} else {
notifyWritabilityChanged(state);
}
}
}
private void notifyWritabilityChanged(FlowState state) {
state.markedWritability(!state.markedWritability());
try {
listener.writabilityChanged(state.stream);
} catch (Throwable cause) {
logger.error("{} Caught Throwable from listener.writabilityChanged for {}",
ctx.channel(), state.stream, cause);
Defined In
Source
Frequently Asked Questions
What is the ListenerWritabilityMonitor class?
ListenerWritabilityMonitor is a class in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2RemoteFlowController.java.
Where is ListenerWritabilityMonitor defined?
ListenerWritabilityMonitor is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2RemoteFlowController.java at line 668.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free