Home / Function/ testFreezeTime() — netty Function Reference

testFreezeTime() — netty Function Reference

Architecture documentation for the testFreezeTime() function in EmbeddedChannelTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  8db66be6_2b0c_65e9_1ed1_77dcf05845b2["testFreezeTime()"]
  300cabef_b042_697f_5623_37ce249f504d["EmbeddedChannelTest"]
  8db66be6_2b0c_65e9_1ed1_77dcf05845b2 -->|defined in| 300cabef_b042_697f_5623_37ce249f504d
  style 8db66be6_2b0c_65e9_1ed1_77dcf05845b2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/embedded/EmbeddedChannelTest.java lines 689–723

    @Test
    @Timeout(30) // generous timeout, just make sure we don't actually wait for the full 10 mins...
    void testFreezeTime() {
        EmbeddedChannel channel = new EmbeddedChannel();
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
            }
        };

        channel.freezeTime();
        // this future will complete after 10min
        ScheduledFuture<?> future10 = channel.eventLoop().schedule(runnable, 10, TimeUnit.MINUTES);
        // this future will complete after 10min + 1ns
        ScheduledFuture<?> future101 = channel.eventLoop().schedule(runnable,
                TimeUnit.MINUTES.toNanos(10) + 1, TimeUnit.NANOSECONDS);
        // this future will complete after 20min
        ScheduledFuture<?> future20 = channel.eventLoop().schedule(runnable, 20, TimeUnit.MINUTES);

        channel.runPendingTasks();
        assertFalse(future10.isDone());
        assertFalse(future101.isDone());
        assertFalse(future20.isDone());

        channel.advanceTimeBy(10, TimeUnit.MINUTES);
        channel.runPendingTasks();
        assertTrue(future10.isDone());
        assertFalse(future101.isDone());
        assertFalse(future20.isDone());

        channel.unfreezeTime();
        channel.runPendingTasks();
        assertTrue(future101.isDone());
        assertFalse(future20.isDone());
    }

Domain

Subdomains

Frequently Asked Questions

What does testFreezeTime() do?
testFreezeTime() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/embedded/EmbeddedChannelTest.java.
Where is testFreezeTime() defined?
testFreezeTime() is defined in transport/src/test/java/io/netty/channel/embedded/EmbeddedChannelTest.java at line 689.

Analyze Your Own Codebase

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

Try Supermodel Free