Home / Function/ testStopTimer() — netty Function Reference

testStopTimer() — netty Function Reference

Architecture documentation for the testStopTimer() function in HashedWheelTimerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4afc3817_5801_81bf_8cb4_ce5d8a87bd0c["testStopTimer()"]
  00b49e45_9607_bed0_2d5f_fd3bdc9b959f["HashedWheelTimerTest"]
  4afc3817_5801_81bf_8cb4_ce5d8a87bd0c -->|defined in| 00b49e45_9607_bed0_2d5f_fd3bdc9b959f
  c46ba577_0225_1b73_1919_e2b7cb5a1767["TimerTask()"]
  4afc3817_5801_81bf_8cb4_ce5d8a87bd0c -->|calls| c46ba577_0225_1b73_1919_e2b7cb5a1767
  style 4afc3817_5801_81bf_8cb4_ce5d8a87bd0c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/test/java/io/netty/util/HashedWheelTimerTest.java lines 68–95

    @Test
    @org.junit.jupiter.api.Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
    public void testStopTimer() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(3);
        final Timer timerProcessed = new HashedWheelTimer();
        for (int i = 0; i < 3; i ++) {
            timerProcessed.newTimeout(new TimerTask() {
                @Override
                public void run(final Timeout timeout) throws Exception {
                    latch.countDown();
                }
            }, 1, TimeUnit.MILLISECONDS);
        }

        latch.await();
        assertEquals(0, timerProcessed.stop().size(), "Number of unprocessed timeouts should be 0");

        final Timer timerUnprocessed = new HashedWheelTimer();
        for (int i = 0; i < 5; i ++) {
            timerUnprocessed.newTimeout(new TimerTask() {
                @Override
                public void run(Timeout timeout) throws Exception {
                }
            }, 5, TimeUnit.SECONDS);
        }
        Thread.sleep(1000L); // sleep for a second
        assertFalse(timerUnprocessed.stop().isEmpty(), "Number of unprocessed timeouts should be greater than 0");
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does testStopTimer() do?
testStopTimer() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/HashedWheelTimerTest.java.
Where is testStopTimer() defined?
testStopTimer() is defined in common/src/test/java/io/netty/util/HashedWheelTimerTest.java at line 68.
What does testStopTimer() call?
testStopTimer() calls 1 function(s): TimerTask.

Analyze Your Own Codebase

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

Try Supermodel Free