Home / Function/ testPendingTimeoutsShouldBeCountedCorrectlyWhenTimeoutCancelledWithinGoalTick() — netty Function Reference

testPendingTimeoutsShouldBeCountedCorrectlyWhenTimeoutCancelledWithinGoalTick() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

common/src/test/java/io/netty/util/HashedWheelTimerTest.java lines 324–350

    @Test
    public void testPendingTimeoutsShouldBeCountedCorrectlyWhenTimeoutCancelledWithinGoalTick()
        throws InterruptedException {
        final HashedWheelTimer timer = new HashedWheelTimer();
        final CountDownLatch barrier = new CountDownLatch(1);
        // A total of 11 timeouts with the same delay are submitted, and they will be processed in the same tick.
        timer.newTimeout(new TimerTask() {
            @Override
            public void run(Timeout timeout) throws Exception {
                barrier.countDown();
                Thread.sleep(1000);
            }
        }, 200, TimeUnit.MILLISECONDS);
        List<Timeout> timeouts = new ArrayList<Timeout>();
        for (int i = 0; i < 10; i++) {
            timeouts.add(timer.newTimeout(createNoOpTimerTask(), 200, TimeUnit.MILLISECONDS));
        }
        barrier.await();
        // The simulation here is that the timeout has been transferred to a bucket and is canceled before it is
        // actually expired in the goal tick.
        for (Timeout timeout : timeouts) {
            timeout.cancel();
        }
        Thread.sleep(2000);
        assertEquals(0, timer.pendingTimeouts());
        timer.stop();
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does testPendingTimeoutsShouldBeCountedCorrectlyWhenTimeoutCancelledWithinGoalTick() do?
testPendingTimeoutsShouldBeCountedCorrectlyWhenTimeoutCancelledWithinGoalTick() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/HashedWheelTimerTest.java.
Where is testPendingTimeoutsShouldBeCountedCorrectlyWhenTimeoutCancelledWithinGoalTick() defined?
testPendingTimeoutsShouldBeCountedCorrectlyWhenTimeoutCancelledWithinGoalTick() is defined in common/src/test/java/io/netty/util/HashedWheelTimerTest.java at line 324.
What does testPendingTimeoutsShouldBeCountedCorrectlyWhenTimeoutCancelledWithinGoalTick() call?
testPendingTimeoutsShouldBeCountedCorrectlyWhenTimeoutCancelledWithinGoalTick() 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