Home / Function/ confirmShutdown() — netty Function Reference

confirmShutdown() — netty Function Reference

Architecture documentation for the confirmShutdown() function in ManualIoEventLoop.java from the netty codebase.

Function java Buffer Search calls 5 called by 1

Entity Profile

Dependency Diagram

graph TD
  eb3c0e75_ca52_c8d2_04c6_92c2e500b077["confirmShutdown()"]
  6e8a7bbd_d782_0f59_8bd2_22f815f8ecad["ManualIoEventLoop"]
  eb3c0e75_ca52_c8d2_04c6_92c2e500b077 -->|defined in| 6e8a7bbd_d782_0f59_8bd2_22f815f8ecad
  e422e9d3_1ca3_619c_c230_1924aa80fc46["runAllTasksBeforeDestroy()"]
  e422e9d3_1ca3_619c_c230_1924aa80fc46 -->|calls| eb3c0e75_ca52_c8d2_04c6_92c2e500b077
  d8560c28_a723_319b_2fa5_b340e2554ead["isShuttingDown()"]
  eb3c0e75_ca52_c8d2_04c6_92c2e500b077 -->|calls| d8560c28_a723_319b_2fa5_b340e2554ead
  cb229a6f_1187_05e7_0073_c0b824cf6ff7["inEventLoop()"]
  eb3c0e75_ca52_c8d2_04c6_92c2e500b077 -->|calls| cb229a6f_1187_05e7_0073_c0b824cf6ff7
  71302cf5_5128_e497_27ae_5d79625b4107["runAllTasks()"]
  eb3c0e75_ca52_c8d2_04c6_92c2e500b077 -->|calls| 71302cf5_5128_e497_27ae_5d79625b4107
  48223eea_986c_3d1d_e693_09a9f5ad5d05["isShutdown()"]
  eb3c0e75_ca52_c8d2_04c6_92c2e500b077 -->|calls| 48223eea_986c_3d1d_e693_09a9f5ad5d05
  729fd7e8_e86c_368b_bd97_0d4948bc5a92["execute()"]
  eb3c0e75_ca52_c8d2_04c6_92c2e500b077 -->|calls| 729fd7e8_e86c_368b_bd97_0d4948bc5a92
  style eb3c0e75_ca52_c8d2_04c6_92c2e500b077 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/ManualIoEventLoop.java lines 559–608

    private boolean confirmShutdown() {
        if (!isShuttingDown()) {
            return false;
        }

        if (!inEventLoop()) {
            throw new IllegalStateException("must be invoked from an event loop");
        }

        cancelScheduledTasks();

        if (gracefulShutdownStartTime == 0) {
            gracefulShutdownStartTime = ticker.nanoTime();
        }

        if (runAllTasks(-1, false) > 0) {
            if (isShutdown()) {
                // Executor shut down - no new tasks anymore.
                return true;
            }

            // There were tasks in the queue. Wait a little bit more until no tasks are queued for the quiet period or
            // terminate if the quiet period is 0.
            // See https://github.com/netty/netty/issues/4241
            if (gracefulShutdownQuietPeriod == 0) {
                return true;
            }
            return false;
        }

        final long nanoTime = ticker.nanoTime();

        if (isShutdown() || nanoTime - gracefulShutdownStartTime > gracefulShutdownTimeout) {
            return true;
        }

        if (nanoTime - lastExecutionTime <= gracefulShutdownQuietPeriod) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                // Ignore
            }

            return false;
        }

        // No tasks were added for last quiet period - hopefully safe to shut down.
        // (Hopefully because we really cannot make a guarantee that there will be no execute() calls by a user.)
        return true;
    }

Domain

Subdomains

Frequently Asked Questions

What does confirmShutdown() do?
confirmShutdown() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/ManualIoEventLoop.java.
Where is confirmShutdown() defined?
confirmShutdown() is defined in transport/src/main/java/io/netty/channel/ManualIoEventLoop.java at line 559.
What does confirmShutdown() call?
confirmShutdown() calls 5 function(s): execute, inEventLoop, isShutdown, isShuttingDown, runAllTasks.
What calls confirmShutdown()?
confirmShutdown() is called by 1 function(s): runAllTasksBeforeDestroy.

Analyze Your Own Codebase

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

Try Supermodel Free