Home / Function/ Runnable() — netty Function Reference

Runnable() — netty Function Reference

Architecture documentation for the Runnable() function in GlobalEventExecutor.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  d2063834_69ba_5d89_1375_f14b3f8cba35["Runnable()"]
  408381e8_b0ab_c53d_3b6c_8d8a15aaa884["GlobalEventExecutor"]
  d2063834_69ba_5d89_1375_f14b3f8cba35 -->|defined in| 408381e8_b0ab_c53d_3b6c_8d8a15aaa884
  411270ac_1d47_f717_3023_68be625f3871["fetchFromScheduledTaskQueue()"]
  d2063834_69ba_5d89_1375_f14b3f8cba35 -->|calls| 411270ac_1d47_f717_3023_68be625f3871
  style d2063834_69ba_5d89_1375_f14b3f8cba35 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java lines 101–138

    Runnable takeTask() {
        BlockingQueue<Runnable> taskQueue = this.taskQueue;
        for (;;) {
            ScheduledFutureTask<?> scheduledTask = peekScheduledTask();
            if (scheduledTask == null) {
                Runnable task = null;
                try {
                    task = taskQueue.take();
                } catch (InterruptedException e) {
                    // Ignore
                }
                return task;
            } else {
                long delayNanos = scheduledTask.delayNanos();
                Runnable task = null;
                if (delayNanos > 0) {
                    try {
                        task = taskQueue.poll(delayNanos, TimeUnit.NANOSECONDS);
                    } catch (InterruptedException e) {
                        // Waken up.
                        return null;
                    }
                }
                if (task == null) {
                    // We need to fetch the scheduled tasks now as otherwise there may be a chance that
                    // scheduled tasks are never executed if there is always one task in the taskQueue.
                    // This is for example true for the read task of OIO Transport
                    // See https://github.com/netty/netty/issues/1614
                    fetchFromScheduledTaskQueue();
                    task = taskQueue.poll();
                }

                if (task != null) {
                    return task;
                }
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does Runnable() do?
Runnable() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java.
Where is Runnable() defined?
Runnable() is defined in common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java at line 101.
What does Runnable() call?
Runnable() calls 1 function(s): fetchFromScheduledTaskQueue.

Analyze Your Own Codebase

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

Try Supermodel Free