Home / Function/ testShouldNotSuspendExecutorWithActiveRegistration() — netty Function Reference

testShouldNotSuspendExecutorWithActiveRegistration() — netty Function Reference

Architecture documentation for the testShouldNotSuspendExecutorWithActiveRegistration() function in MultiThreadIoEventLoopGroupTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e7d55bd2_9308_0bb3_c01a_5eb1fee6b142["testShouldNotSuspendExecutorWithActiveRegistration()"]
  b4c07204_4723_7056_4606_4ede1e592317["MultiThreadIoEventLoopGroupTest"]
  e7d55bd2_9308_0bb3_c01a_5eb1fee6b142 -->|defined in| b4c07204_4723_7056_4606_4ede1e592317
  aa8fb275_3a23_d235_0ce3_bc0498b4422d["TestMultiThreadIoEventLoopGroup()"]
  e7d55bd2_9308_0bb3_c01a_5eb1fee6b142 -->|calls| aa8fb275_3a23_d235_0ce3_bc0498b4422d
  45e835b7_601b_955d_a619_3fc8956adbbc["startAllExecutors()"]
  e7d55bd2_9308_0bb3_c01a_5eb1fee6b142 -->|calls| 45e835b7_601b_955d_a619_3fc8956adbbc
  5adea2a2_060c_b4a5_62c9_a2b2c4c16c53["waitForSuspension()"]
  e7d55bd2_9308_0bb3_c01a_5eb1fee6b142 -->|calls| 5adea2a2_060c_b4a5_62c9_a2b2c4c16c53
  7f3d45f6_1f4d_1a16_9fd4_70c9200affc0["countActiveExecutors()"]
  e7d55bd2_9308_0bb3_c01a_5eb1fee6b142 -->|calls| 7f3d45f6_1f4d_1a16_9fd4_70c9200affc0
  d2742b96_6092_a292_9533_c669707fc8db["setSimulateWorkload()"]
  e7d55bd2_9308_0bb3_c01a_5eb1fee6b142 -->|calls| d2742b96_6092_a292_9533_c669707fc8db
  style e7d55bd2_9308_0bb3_c01a_5eb1fee6b142 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/MultiThreadIoEventLoopGroupTest.java lines 177–210

    @Test
    @Timeout(30)
    public void testShouldNotSuspendExecutorWithActiveRegistration() throws InterruptedException {
        TestMultiThreadIoEventLoopGroup group = new TestMultiThreadIoEventLoopGroup(0, 2, 200, TimeUnit.MILLISECONDS);
        try {
            startAllExecutors(group);
            waitForSuspension(group, 1, 2000);
            assertEquals(1, countActiveExecutors(group), "One executor should have been suspended");

            TestableIoEventLoop activeExecutor = (TestableIoEventLoop) findActiveExecutor(group);
            assertNotNull(activeExecutor, "One executor should remain active");

            // Register a handle with the active executor. This makes registeredChannels() return 1.
            IoRegistration registration = activeExecutor.register(new TestIoHandle()).syncUninterruptibly().getNow();

            // The executor is now a candidate for suspension based on utilization,
            // but not based on registered channels.
            activeExecutor.setSimulateWorkload(false);

            // Wait for a few monitor cycles. The monitor will run and see the executor is idle.
            Thread.sleep(600);

            assertFalse(activeExecutor.isSuspended(),
                        "Executor with an active registration should not be suspended, even if idle");
            assertEquals(1, countActiveExecutors(group), "Only one executor should still be active");

            assertTrue(registration.cancel());
            waitForSuspension(group, 2, 2000);
            assertTrue(activeExecutor.isSuspended(),
                       "Executor should suspend after registration is cancelled and it remains idle");
        } finally {
            group.shutdownGracefully().syncUninterruptibly();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testShouldNotSuspendExecutorWithActiveRegistration() do?
testShouldNotSuspendExecutorWithActiveRegistration() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/MultiThreadIoEventLoopGroupTest.java.
Where is testShouldNotSuspendExecutorWithActiveRegistration() defined?
testShouldNotSuspendExecutorWithActiveRegistration() is defined in transport/src/test/java/io/netty/channel/MultiThreadIoEventLoopGroupTest.java at line 177.
What does testShouldNotSuspendExecutorWithActiveRegistration() call?
testShouldNotSuspendExecutorWithActiveRegistration() calls 5 function(s): TestMultiThreadIoEventLoopGroup, countActiveExecutors, setSimulateWorkload, startAllExecutors, waitForSuspension.

Analyze Your Own Codebase

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

Try Supermodel Free