Home / Function/ run() — netty Function Reference

run() — netty Function Reference

Architecture documentation for the run() function in HashedWheelTimer.java from the netty codebase.

Function java CommonUtil Logging calls 9 called by 1

Entity Profile

Dependency Diagram

graph TD
  ea613877_8294_fd85_27b0_0c4903842ef1["run()"]
  97b31b84_3527_3690_913b_44ff6fafb9cc["Worker"]
  ea613877_8294_fd85_27b0_0c4903842ef1 -->|defined in| 97b31b84_3527_3690_913b_44ff6fafb9cc
  00b766fb_0621_6e36_49ab_b8d6c53c1de8["run()"]
  00b766fb_0621_6e36_49ab_b8d6c53c1de8 -->|calls| ea613877_8294_fd85_27b0_0c4903842ef1
  00b766fb_0621_6e36_49ab_b8d6c53c1de8["run()"]
  ea613877_8294_fd85_27b0_0c4903842ef1 -->|calls| 00b766fb_0621_6e36_49ab_b8d6c53c1de8
  e9d21410_9c1d_0eec_d368_c04bdb308bdb["start()"]
  ea613877_8294_fd85_27b0_0c4903842ef1 -->|calls| e9d21410_9c1d_0eec_d368_c04bdb308bdb
  9f207468_c502_a117_0557_1b7c3aca33b8["waitForNextTick()"]
  ea613877_8294_fd85_27b0_0c4903842ef1 -->|calls| 9f207468_c502_a117_0557_1b7c3aca33b8
  f4e4374f_cea1_44a1_d8cc_b9bc9e38ac91["processCancelledTasks()"]
  ea613877_8294_fd85_27b0_0c4903842ef1 -->|calls| f4e4374f_cea1_44a1_d8cc_b9bc9e38ac91
  1a7f3952_1dcf_b390_f3fc_948e608ef456["transferTimeoutsToBuckets()"]
  ea613877_8294_fd85_27b0_0c4903842ef1 -->|calls| 1a7f3952_1dcf_b390_f3fc_948e608ef456
  3d9ffcbb_3ea5_25ee_4523_6b747b12dc26["expireTimeouts()"]
  ea613877_8294_fd85_27b0_0c4903842ef1 -->|calls| 3d9ffcbb_3ea5_25ee_4523_6b747b12dc26
  bd4bf731_7996_ea82_2640_1afb233683ee["stop()"]
  ea613877_8294_fd85_27b0_0c4903842ef1 -->|calls| bd4bf731_7996_ea82_2640_1afb233683ee
  62a2ff61_68bd_e1a0_10db_cd640e0d9647["clearTimeouts()"]
  ea613877_8294_fd85_27b0_0c4903842ef1 -->|calls| 62a2ff61_68bd_e1a0_10db_cd640e0d9647
  5966b70d_fc04_1bcb_0af7_d7180add2531["isCancelled()"]
  ea613877_8294_fd85_27b0_0c4903842ef1 -->|calls| 5966b70d_fc04_1bcb_0af7_d7180add2531
  style ea613877_8294_fd85_27b0_0c4903842ef1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/HashedWheelTimer.java lines 481–520

        @Override
        public void run() {
            // Initialize the startTime.
            startTime = System.nanoTime();
            if (startTime == 0) {
                // We use 0 as an indicator for the uninitialized value here, so make sure it's not 0 when initialized.
                startTime = 1;
            }

            // Notify the other threads waiting for the initialization at start().
            startTimeInitialized.countDown();

            do {
                final long deadline = waitForNextTick();
                if (deadline > 0) {
                    int idx = (int) (tick & mask);
                    processCancelledTasks();
                    HashedWheelBucket bucket =
                            wheel[idx];
                    transferTimeoutsToBuckets();
                    bucket.expireTimeouts(deadline);
                    tick++;
                }
            } while (WORKER_STATE_UPDATER.get(HashedWheelTimer.this) == WORKER_STATE_STARTED);

            // Fill the unprocessedTimeouts so we can return them from stop() method.
            for (HashedWheelBucket bucket: wheel) {
                bucket.clearTimeouts(unprocessedTimeouts);
            }
            for (;;) {
                HashedWheelTimeout timeout = timeouts.poll();
                if (timeout == null) {
                    break;
                }
                if (!timeout.isCancelled()) {
                    unprocessedTimeouts.add(timeout);
                }
            }
            processCancelledTasks();
        }

Domain

Subdomains

Called By

Frequently Asked Questions

What does run() do?
run() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/HashedWheelTimer.java.
Where is run() defined?
run() is defined in common/src/main/java/io/netty/util/HashedWheelTimer.java at line 481.
What does run() call?
run() calls 9 function(s): clearTimeouts, expireTimeouts, isCancelled, processCancelledTasks, run, start, stop, transferTimeoutsToBuckets, and 1 more.
What calls run()?
run() is called by 1 function(s): run.

Analyze Your Own Codebase

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

Try Supermodel Free