Home / Function/ Timeout() — netty Function Reference

Timeout() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  7215ccab_c52a_80a7_3797_88ce5715a703["Timeout()"]
  0a75019c_ba28_3729_1e96_e0724c6ddc24["HashedWheelTimer"]
  7215ccab_c52a_80a7_3797_88ce5715a703 -->|defined in| 0a75019c_ba28_3729_1e96_e0724c6ddc24
  e9d21410_9c1d_0eec_d368_c04bdb308bdb["start()"]
  7215ccab_c52a_80a7_3797_88ce5715a703 -->|calls| e9d21410_9c1d_0eec_d368_c04bdb308bdb
  00653983_4442_5cb1_c3f9_bf5c5ba28319["HashedWheelTimeout()"]
  7215ccab_c52a_80a7_3797_88ce5715a703 -->|calls| 00653983_4442_5cb1_c3f9_bf5c5ba28319
  style 7215ccab_c52a_80a7_3797_88ce5715a703 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/HashedWheelTimer.java lines 431–458

    @Override
    public Timeout newTimeout(TimerTask task, long delay, TimeUnit unit) {
        checkNotNull(task, "task");
        checkNotNull(unit, "unit");

        long pendingTimeoutsCount = pendingTimeouts.incrementAndGet();

        if (maxPendingTimeouts > 0 && pendingTimeoutsCount > maxPendingTimeouts) {
            pendingTimeouts.decrementAndGet();
            throw new RejectedExecutionException("Number of pending timeouts ("
                + pendingTimeoutsCount + ") is greater than or equal to maximum allowed pending "
                + "timeouts (" + maxPendingTimeouts + ")");
        }

        start();

        // Add the timeout to the timeout queue which will be processed on the next tick.
        // During processing all the queued HashedWheelTimeouts will be added to the correct HashedWheelBucket.
        long deadline = System.nanoTime() + unit.toNanos(delay) - startTime;

        // Guard against overflow.
        if (delay > 0 && deadline < 0) {
            deadline = Long.MAX_VALUE;
        }
        HashedWheelTimeout timeout = new HashedWheelTimeout(this, task, deadline);
        timeouts.add(timeout);
        return timeout;
    }

Domain

Subdomains

Frequently Asked Questions

What does Timeout() do?
Timeout() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/HashedWheelTimer.java.
Where is Timeout() defined?
Timeout() is defined in common/src/main/java/io/netty/util/HashedWheelTimer.java at line 431.
What does Timeout() call?
Timeout() calls 2 function(s): HashedWheelTimeout, start.

Analyze Your Own Codebase

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

Try Supermodel Free