Home / Function/ disconnect() — netty Function Reference

disconnect() — netty Function Reference

Architecture documentation for the disconnect() function in AbstractChannel.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  49488e5c_2130_0f61_1882_15fe94cba0eb["disconnect()"]
  330d05c9_85ca_2e57_92f5_e996fb442b81["AbstractUnsafe"]
  49488e5c_2130_0f61_1882_15fe94cba0eb -->|defined in| 330d05c9_85ca_2e57_92f5_e996fb442b81
  30686258_744e_d516_027d_4264d61dbea3["assertEventLoop()"]
  49488e5c_2130_0f61_1882_15fe94cba0eb -->|calls| 30686258_744e_d516_027d_4264d61dbea3
  fa248cc8_aa4f_8fe0_e818_95b3736f9ac5["doDisconnect()"]
  49488e5c_2130_0f61_1882_15fe94cba0eb -->|calls| fa248cc8_aa4f_8fe0_e818_95b3736f9ac5
  09594916_b369_0dde_fab6_d2f3c2bd81b1["safeSetFailure()"]
  49488e5c_2130_0f61_1882_15fe94cba0eb -->|calls| 09594916_b369_0dde_fab6_d2f3c2bd81b1
  2a754051_6240_e8f0_34c4_f563ed9252f9["closeIfClosed()"]
  49488e5c_2130_0f61_1882_15fe94cba0eb -->|calls| 2a754051_6240_e8f0_34c4_f563ed9252f9
  b76c888c_4df5_fe91_84fb_25d571b70e8a["invokeLater()"]
  49488e5c_2130_0f61_1882_15fe94cba0eb -->|calls| b76c888c_4df5_fe91_84fb_25d571b70e8a
  bc29f802_b297_1770_91f3_caeb36e61763["safeSetSuccess()"]
  49488e5c_2130_0f61_1882_15fe94cba0eb -->|calls| bc29f802_b297_1770_91f3_caeb36e61763
  style 49488e5c_2130_0f61_1882_15fe94cba0eb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/AbstractChannel.java lines 450–481

        @Override
        public final void disconnect(final ChannelPromise promise) {
            assertEventLoop();

            if (!promise.setUncancellable()) {
                return;
            }

            boolean wasActive = isActive();
            try {
                doDisconnect();
                // Reset remoteAddress and localAddress
                remoteAddress = null;
                localAddress = null;
            } catch (Throwable t) {
                safeSetFailure(promise, t);
                closeIfClosed();
                return;
            }

            if (wasActive && !isActive()) {
                invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        pipeline.fireChannelInactive();
                    }
                });
            }

            safeSetSuccess(promise);
            closeIfClosed(); // doDisconnect() might have closed the channel
        }

Domain

Subdomains

Frequently Asked Questions

What does disconnect() do?
disconnect() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/AbstractChannel.java.
Where is disconnect() defined?
disconnect() is defined in transport/src/main/java/io/netty/channel/AbstractChannel.java at line 450.
What does disconnect() call?
disconnect() calls 6 function(s): assertEventLoop, closeIfClosed, doDisconnect, invokeLater, safeSetFailure, safeSetSuccess.

Analyze Your Own Codebase

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

Try Supermodel Free