Home / Function/ transferTimeoutsToBuckets() — netty Function Reference

transferTimeoutsToBuckets() — netty Function Reference

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

Function java CommonUtil Logging calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  1a7f3952_1dcf_b390_f3fc_948e608ef456["transferTimeoutsToBuckets()"]
  97b31b84_3527_3690_913b_44ff6fafb9cc["Worker"]
  1a7f3952_1dcf_b390_f3fc_948e608ef456 -->|defined in| 97b31b84_3527_3690_913b_44ff6fafb9cc
  ea613877_8294_fd85_27b0_0c4903842ef1["run()"]
  ea613877_8294_fd85_27b0_0c4903842ef1 -->|calls| 1a7f3952_1dcf_b390_f3fc_948e608ef456
  a5248b2c_32f7_6134_ae9f_c1399b1b98d9["state()"]
  1a7f3952_1dcf_b390_f3fc_948e608ef456 -->|calls| a5248b2c_32f7_6134_ae9f_c1399b1b98d9
  78938a23_b7a7_64b9_dae3_04a0c9ec0b4b["addTimeout()"]
  1a7f3952_1dcf_b390_f3fc_948e608ef456 -->|calls| 78938a23_b7a7_64b9_dae3_04a0c9ec0b4b
  style 1a7f3952_1dcf_b390_f3fc_948e608ef456 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/HashedWheelTimer.java lines 522–545

        private void transferTimeoutsToBuckets() {
            // transfer only max. 100000 timeouts per tick to prevent a thread to stale the workerThread when it just
            // adds new timeouts in a loop.
            for (int i = 0; i < 100000; i++) {
                HashedWheelTimeout timeout = timeouts.poll();
                if (timeout == null) {
                    // all processed
                    break;
                }
                if (timeout.state() == HashedWheelTimeout.ST_CANCELLED) {
                    // Was cancelled in the meantime.
                    continue;
                }

                long calculated = timeout.deadline / tickDuration;
                timeout.remainingRounds = (calculated - tick) / wheel.length;

                final long ticks = Math.max(calculated, tick); // Ensure we don't schedule for past.
                int stopIndex = (int) (ticks & mask);

                HashedWheelBucket bucket = wheel[stopIndex];
                bucket.addTimeout(timeout);
            }
        }

Domain

Subdomains

Called By

Frequently Asked Questions

What does transferTimeoutsToBuckets() do?
transferTimeoutsToBuckets() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/HashedWheelTimer.java.
Where is transferTimeoutsToBuckets() defined?
transferTimeoutsToBuckets() is defined in common/src/main/java/io/netty/util/HashedWheelTimer.java at line 522.
What does transferTimeoutsToBuckets() call?
transferTimeoutsToBuckets() calls 2 function(s): addTimeout, state.
What calls transferTimeoutsToBuckets()?
transferTimeoutsToBuckets() 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