Home / Function/ sleep() — netty Function Reference

sleep() — netty Function Reference

Architecture documentation for the sleep() function in DefaultMockTicker.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  a758e7d3_3755_e7fd_392c_5107c5788ed7["sleep()"]
  f544a2b2_a145_f856_fb22_69a427bff1ce["DefaultMockTicker"]
  a758e7d3_3755_e7fd_392c_5107c5788ed7 -->|defined in| f544a2b2_a145_f856_fb22_69a427bff1ce
  fef2186d_597b_bf6f_c80a_9284863e05ee["nanoTime()"]
  a758e7d3_3755_e7fd_392c_5107c5788ed7 -->|calls| fef2186d_597b_bf6f_c80a_9284863e05ee
  style a758e7d3_3755_e7fd_392c_5107c5788ed7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/concurrent/DefaultMockTicker.java lines 46–68

    @Override
    public void sleep(long delay, TimeUnit unit) throws InterruptedException {
        checkPositiveOrZero(delay, "delay");
        requireNonNull(unit, "unit");

        if (delay == 0) {
            return;
        }

        final long delayNanos = unit.toNanos(delay);
        lock.lockInterruptibly();
        try {
            final long startTimeNanos = nanoTime();
            sleepers.add(Thread.currentThread());
            sleeperCondition.signalAll();
            do {
                tickCondition.await();
            } while (nanoTime() - startTimeNanos < delayNanos);
        } finally {
            sleepers.remove(Thread.currentThread());
            lock.unlock();
        }
    }

Domain

Subdomains

Calls

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free