Home / Function/ testCustomTicker() — netty Function Reference

testCustomTicker() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/embedded/EmbeddedChannelTest.java lines 725–759

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

        // 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());

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

        ticker.advance(1, TimeUnit.NANOSECONDS);
        channel.runPendingTasks();
        assertTrue(future101.isDone());
        assertFalse(future20.isDone());
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free