Home / Function/ runAllTasks() — netty Function Reference

runAllTasks() — netty Function Reference

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

Function java Buffer Telemetry calls 1 called by 4

Entity Profile

Dependency Diagram

graph TD
  71302cf5_5128_e497_27ae_5d79625b4107["runAllTasks()"]
  6e8a7bbd_d782_0f59_8bd2_22f815f8ecad["ManualIoEventLoop"]
  71302cf5_5128_e497_27ae_5d79625b4107 -->|defined in| 6e8a7bbd_d782_0f59_8bd2_22f815f8ecad
  be6ea593_639f_917a_13de_afe35af4ff4a["runNonBlockingTasks()"]
  be6ea593_639f_917a_13de_afe35af4ff4a -->|calls| 71302cf5_5128_e497_27ae_5d79625b4107
  5047d6fd_705b_2516_f43b_43d0d4eed8f0["run()"]
  5047d6fd_705b_2516_f43b_43d0d4eed8f0 -->|calls| 71302cf5_5128_e497_27ae_5d79625b4107
  e422e9d3_1ca3_619c_c230_1924aa80fc46["runAllTasksBeforeDestroy()"]
  e422e9d3_1ca3_619c_c230_1924aa80fc46 -->|calls| 71302cf5_5128_e497_27ae_5d79625b4107
  eb3c0e75_ca52_c8d2_04c6_92c2e500b077["confirmShutdown()"]
  eb3c0e75_ca52_c8d2_04c6_92c2e500b077 -->|calls| 71302cf5_5128_e497_27ae_5d79625b4107
  cb229a6f_1187_05e7_0073_c0b824cf6ff7["inEventLoop()"]
  71302cf5_5128_e497_27ae_5d79625b4107 -->|calls| cb229a6f_1187_05e7_0073_c0b824cf6ff7
  style 71302cf5_5128_e497_27ae_5d79625b4107 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/ManualIoEventLoop.java lines 172–213

    private int runAllTasks(long timeoutNanos, boolean setCurrentExecutor) {
        assert inEventLoop();
        final Queue<Runnable> taskQueue = this.taskQueue;
        // since the taskQueue is unbounded we don't need to keep on calling this while draining it.
        boolean alwaysTrue = fetchFromScheduledTaskQueue(taskQueue);
        assert alwaysTrue;
        Runnable task = taskQueue.poll();
        if (task == null) {
            return 0;
        }
        EventExecutor old = setCurrentExecutor? ThreadExecutorMap.setCurrentExecutor(this) : null;
        try {
            final long deadline = timeoutNanos > 0 ? getCurrentTimeNanos() + timeoutNanos : 0;
            int runTasks = 0;
            long lastExecutionTime;
            final Ticker ticker = this.ticker;
            for (;;) {
                safeExecute(task);

                runTasks++;

               if (timeoutNanos > 0) {
                    lastExecutionTime = ticker.nanoTime();
                    if ((lastExecutionTime - deadline) >= 0) {
                        break;
                    }
                }

                task = taskQueue.poll();
                if (task == null) {
                    lastExecutionTime = ticker.nanoTime();
                    break;
                }
            }
            this.lastExecutionTime = lastExecutionTime;
            return runTasks;
        } finally {
            if (setCurrentExecutor) {
                ThreadExecutorMap.setCurrentExecutor(old);
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free