Home / Function/ shutdown0() — netty Function Reference

shutdown0() — netty Function Reference

Architecture documentation for the shutdown0() function in SingleThreadEventExecutor.java from the netty codebase.

Function java CommonUtil Concurrent calls 4 called by 2

Entity Profile

Dependency Diagram

graph TD
  3883639c_b779_4c47_6f43_da56209b65a2["shutdown0()"]
  c9189467_acbc_07ea_3a8c_fecfe22ec122["SingleThreadEventExecutor"]
  3883639c_b779_4c47_6f43_da56209b65a2 -->|defined in| c9189467_acbc_07ea_3a8c_fecfe22ec122
  040a25b4_1bfa_ef1f_4287_f521c2abea05["shutdownGracefully()"]
  040a25b4_1bfa_ef1f_4287_f521c2abea05 -->|calls| 3883639c_b779_4c47_6f43_da56209b65a2
  6717492f_1569_c2aa_ee43_ef4573fb9003["shutdown()"]
  6717492f_1569_c2aa_ee43_ef4573fb9003 -->|calls| 3883639c_b779_4c47_6f43_da56209b65a2
  f254ed93_aa2e_8b8e_4769_4040c5b44cf0["isShuttingDown()"]
  3883639c_b779_4c47_6f43_da56209b65a2 -->|calls| f254ed93_aa2e_8b8e_4769_4040c5b44cf0
  957fd634_92d8_ad7a_8d3f_c6d9e5d7ee2a["inEventLoop()"]
  3883639c_b779_4c47_6f43_da56209b65a2 -->|calls| 957fd634_92d8_ad7a_8d3f_c6d9e5d7ee2a
  a492b7bc_add7_4389_0b97_074f0f1429af["ensureThreadStarted()"]
  3883639c_b779_4c47_6f43_da56209b65a2 -->|calls| a492b7bc_add7_4389_0b97_074f0f1429af
  a1d3a8d1_9238_e4b8_bc99_db8bd82af78f["wakeup()"]
  3883639c_b779_4c47_6f43_da56209b65a2 -->|calls| a1d3a8d1_9238_e4b8_bc99_db8bd82af78f
  style 3883639c_b779_4c47_6f43_da56209b65a2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java lines 773–824

    private void shutdown0(long quietPeriod, long timeout, int shutdownState) {
        if (isShuttingDown()) {
            return;
        }

        boolean inEventLoop = inEventLoop();
        boolean wakeup;
        int oldState;
        for (;;) {
            if (isShuttingDown()) {
                return;
            }
            int newState;
            wakeup = true;
            oldState = state;
            if (inEventLoop) {
                newState = shutdownState;
            } else {
                switch (oldState) {
                    case ST_NOT_STARTED:
                    case ST_STARTED:
                    case ST_SUSPENDING:
                    case ST_SUSPENDED:
                        newState = shutdownState;
                        break;
                    default:
                        newState = oldState;
                        wakeup = false;
                }
            }
            if (STATE_UPDATER.compareAndSet(this, oldState, newState)) {
                break;
            }
        }
        if (quietPeriod != -1) {
            gracefulShutdownQuietPeriod = quietPeriod;
        }
        if (timeout != -1) {
            gracefulShutdownTimeout = timeout;
        }

        if (ensureThreadStarted(oldState)) {
            return;
        }

        if (wakeup) {
            taskQueue.offer(WAKEUP_TASK);
            if (!addTaskWakesUp) {
                wakeup(inEventLoop);
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does shutdown0() do?
shutdown0() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java.
Where is shutdown0() defined?
shutdown0() is defined in common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java at line 773.
What does shutdown0() call?
shutdown0() calls 4 function(s): ensureThreadStarted, inEventLoop, isShuttingDown, wakeup.
What calls shutdown0()?
shutdown0() is called by 2 function(s): shutdown, shutdownGracefully.

Analyze Your Own Codebase

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

Try Supermodel Free