close() — netty Function Reference
Architecture documentation for the close() function in DefaultHttp2Connection.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 4e51c63f_9d46_ed86_5c89_3ee5a0e03ae9["close()"] 05fa194d_d048_a70f_6ef9_91439d2abc10["DefaultHttp2Connection"] 4e51c63f_9d46_ed86_5c89_3ee5a0e03ae9 -->|defined in| 05fa194d_d048_a70f_6ef9_91439d2abc10 80052cac_166f_4c64_c049_6dfe2d58c656["closeStreamsGreaterThanLastKnownStreamId()"] 80052cac_166f_4c64_c049_6dfe2d58c656 -->|calls| 4e51c63f_9d46_ed86_5c89_3ee5a0e03ae9 b0bbabf3_9ef1_59e5_be02_dd1e1c9fd442["Http2Stream()"] b0bbabf3_9ef1_59e5_be02_dd1e1c9fd442 -->|calls| 4e51c63f_9d46_ed86_5c89_3ee5a0e03ae9 a7609e2d_83bd_5738_2280_7554d5e27734["Http2Stream()"] a7609e2d_83bd_5738_2280_7554d5e27734 -->|calls| 4e51c63f_9d46_ed86_5c89_3ee5a0e03ae9 1ca6cdd9_06c4_3202_3b0c_85ca5c06b18c["isStreamMapEmpty()"] 4e51c63f_9d46_ed86_5c89_3ee5a0e03ae9 -->|calls| 1ca6cdd9_06c4_3202_3b0c_85ca5c06b18c ea157506_1684_b850_8aa9_ff162ce821de["allowModifications()"] 4e51c63f_9d46_ed86_5c89_3ee5a0e03ae9 -->|calls| ea157506_1684_b850_8aa9_ff162ce821de f0f9ba92_f6b6_9036_9ef7_235938810d6c["incrementPendingIterations()"] 4e51c63f_9d46_ed86_5c89_3ee5a0e03ae9 -->|calls| f0f9ba92_f6b6_9036_9ef7_235938810d6c 9d7263ab_8421_ff18_0764_884071aa14a0["id()"] 4e51c63f_9d46_ed86_5c89_3ee5a0e03ae9 -->|calls| 9d7263ab_8421_ff18_0764_884071aa14a0 d59982c4_2840_f395_d369_855f817593af["decrementPendingIterations()"] 4e51c63f_9d46_ed86_5c89_3ee5a0e03ae9 -->|calls| d59982c4_2840_f395_d369_855f817593af style 4e51c63f_9d46_ed86_5c89_3ee5a0e03ae9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Connection.java lines 118–168
@Override
public Future<Void> close(final Promise<Void> promise) {
checkNotNull(promise, "promise");
// Since we allow this method to be called multiple times, we must make sure that all the promises are notified
// when all streams are removed and the close operation completes.
if (closePromise != null) {
if (closePromise == promise) {
// Do nothing
} else if (promise instanceof ChannelPromise && ((ChannelFuture) closePromise).isVoid()) {
closePromise = promise;
} else {
PromiseNotifier.cascade(closePromise, promise);
}
} else {
closePromise = promise;
}
if (isStreamMapEmpty()) {
promise.trySuccess(null);
return promise;
}
Iterator<PrimitiveEntry<Http2Stream>> itr = streamMap.entries().iterator();
// We must take care while iterating the streamMap as to not modify while iterating in case there are other code
// paths iterating over the active streams.
if (activeStreams.allowModifications()) {
activeStreams.incrementPendingIterations();
try {
while (itr.hasNext()) {
DefaultStream stream = (DefaultStream) itr.next().value();
if (stream.id() != CONNECTION_STREAM_ID) {
// If modifications of the activeStream map is allowed, then a stream close operation will also
// modify the streamMap. Pass the iterator in so that remove will be called to prevent
// concurrent modification exceptions.
stream.close(itr);
}
}
} finally {
activeStreams.decrementPendingIterations();
}
} else {
while (itr.hasNext()) {
Http2Stream stream = itr.next().value();
if (stream.id() != CONNECTION_STREAM_ID) {
// We are not allowed to make modifications, so the close calls will be executed after this
// iteration completes.
stream.close();
}
}
}
return closePromise;
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does close() do?
close() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Connection.java.
Where is close() defined?
close() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Connection.java at line 118.
What does close() call?
close() calls 5 function(s): allowModifications, decrementPendingIterations, id, incrementPendingIterations, isStreamMapEmpty.
What calls close()?
close() is called by 3 function(s): Http2Stream, Http2Stream, closeStreamsGreaterThanLastKnownStreamId.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free