Home / Function/ close() — netty Function Reference

close() — netty Function Reference

Architecture documentation for the close() function in Http2ConnectionHandler.java from the netty codebase.

Function java Buffer Allocators calls 4 called by 4

Entity Profile

Dependency Diagram

graph TD
  859f94fe_ed5e_1249_ef66_7ee4bcad0137["close()"]
  a9ab361d_2417_0366_d9d0_ae1adb2145dc["Http2ConnectionHandler"]
  859f94fe_ed5e_1249_ef66_7ee4bcad0137 -->|defined in| a9ab361d_2417_0366_d9d0_ae1adb2145dc
  4992b0b8_e1a4_4681_744c_1e39df6dddf2["doCloseStream()"]
  4992b0b8_e1a4_4681_744c_1e39df6dddf2 -->|calls| 859f94fe_ed5e_1249_ef66_7ee4bcad0137
  1cee60a0_8f17_5766_d0e0_5a2a786a1ab0["processGoAwayWriteResult()"]
  1cee60a0_8f17_5766_d0e0_5a2a786a1ab0 -->|calls| 859f94fe_ed5e_1249_ef66_7ee4bcad0137
  13472518_8540_e0ef_4907_dd1c5bb8675f["channelInactive()"]
  13472518_8540_e0ef_4907_dd1c5bb8675f -->|calls| 859f94fe_ed5e_1249_ef66_7ee4bcad0137
  60a1ffc0_2a6c_10ae_8455_5c9e7c6be857["doClose()"]
  60a1ffc0_2a6c_10ae_8455_5c9e7c6be857 -->|calls| 859f94fe_ed5e_1249_ef66_7ee4bcad0137
  c32d616e_2a2b_2074_6f4f_9c9367054c5b["write()"]
  859f94fe_ed5e_1249_ef66_7ee4bcad0137 -->|calls| c32d616e_2a2b_2074_6f4f_9c9367054c5b
  fcfd6790_7b31_2514_7e7e_6ee61c0daff9["flush()"]
  859f94fe_ed5e_1249_ef66_7ee4bcad0137 -->|calls| fcfd6790_7b31_2514_7e7e_6ee61c0daff9
  401e2e76_994c_3bf5_9e43_754e2ba61459["doGracefulShutdown()"]
  859f94fe_ed5e_1249_ef66_7ee4bcad0137 -->|calls| 401e2e76_994c_3bf5_9e43_754e2ba61459
  7ac4a90e_d0ae_14a9_10cc_cd77b04bff6c["prefaceSent()"]
  859f94fe_ed5e_1249_ef66_7ee4bcad0137 -->|calls| 7ac4a90e_d0ae_14a9_10cc_cd77b04bff6c
  style 859f94fe_ed5e_1249_ef66_7ee4bcad0137 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java lines 479–500

    @Override
    public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception {
        if (decoupleCloseAndGoAway) {
            ctx.close(promise);
            return;
        }
        promise = promise.unvoid();
        // Avoid NotYetConnectedException and avoid sending before connection preface
        if (!ctx.channel().isActive() || !prefaceSent()) {
            ctx.close(promise);
            return;
        }

        // If the user has already sent a GO_AWAY frame they may be attempting to do a graceful shutdown which requires
        // sending multiple GO_AWAY frames. We should only send a GO_AWAY here if one has not already been sent. If
        // a GO_AWAY has been sent we send a empty buffer just so we can wait to close until all other data has been
        // flushed to the OS.
        // https://github.com/netty/netty/issues/5307
        ChannelFuture f = connection().goAwaySent() ? ctx.write(EMPTY_BUFFER) : goAway(ctx, null, ctx.newPromise());
        ctx.flush();
        doGracefulShutdown(ctx, f, promise);
    }

Domain

Subdomains

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/Http2ConnectionHandler.java.
Where is close() defined?
close() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java at line 479.
What does close() call?
close() calls 4 function(s): doGracefulShutdown, flush, prefaceSent, write.
What calls close()?
close() is called by 4 function(s): channelInactive, doClose, doCloseStream, processGoAwayWriteResult.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free