Home / Function/ drainTasks() — netty Function Reference

drainTasks() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  f4291ef2_179c_42ad_870a_2283c38d406a["drainTasks()"]
  c9189467_acbc_07ea_3a8c_fecfe22ec122["SingleThreadEventExecutor"]
  f4291ef2_179c_42ad_870a_2283c38d406a -->|defined in| c9189467_acbc_07ea_3a8c_fecfe22ec122
  8eb7fcd3_fddd_aede_4b6c_2483c2c54021["doStartThread()"]
  8eb7fcd3_fddd_aede_4b6c_2483c2c54021 -->|calls| f4291ef2_179c_42ad_870a_2283c38d406a
  style f4291ef2_179c_42ad_870a_2283c38d406a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java lines 1308–1322

    final int drainTasks() {
        int numTasks = 0;
        for (;;) {
            Runnable runnable = taskQueue.poll();
            if (runnable == null) {
                break;
            }
            // WAKEUP_TASK should be just discarded as these are added internally.
            // The important bit is that we not have any user tasks left.
            if (WAKEUP_TASK != runnable) {
                numTasks++;
            }
        }
        return numTasks;
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does drainTasks() do?
drainTasks() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java.
Where is drainTasks() defined?
drainTasks() is defined in common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java at line 1308.
What calls drainTasks()?
drainTasks() is called by 1 function(s): doStartThread.

Analyze Your Own Codebase

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

Try Supermodel Free