Home / Function/ testScalingWithIoRegistrationLifecycle() — netty Function Reference

testScalingWithIoRegistrationLifecycle() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/MultiThreadIoEventLoopGroupTest.java lines 144–175

    @Test
    @Timeout(30)
    public void testScalingWithIoRegistrationLifecycle() throws InterruptedException {
        TestMultiThreadIoEventLoopGroup group = new TestMultiThreadIoEventLoopGroup(0, 2, 200, TimeUnit.MILLISECONDS);
        try {
            startAllExecutors(group);
            assertEquals(2, countActiveExecutors(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");

            IoRegistration registration = activeExecutor.register(new TestIoHandle()).syncUninterruptibly().getNow();
            activeExecutor.setSimulateWorkload(true);

            Thread.sleep(450);

            // The executor will not be suspended because its workload generates utilization.
            assertFalse(activeExecutor.isSuspended(), "Executor with active handle should not be suspended");

            activeExecutor.setSimulateWorkload(false);
            assertTrue(registration.cancel());

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

Domain

Subdomains

Frequently Asked Questions

What does testScalingWithIoRegistrationLifecycle() do?
testScalingWithIoRegistrationLifecycle() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/MultiThreadIoEventLoopGroupTest.java.
Where is testScalingWithIoRegistrationLifecycle() defined?
testScalingWithIoRegistrationLifecycle() is defined in transport/src/test/java/io/netty/channel/MultiThreadIoEventLoopGroupTest.java at line 144.
What does testScalingWithIoRegistrationLifecycle() call?
testScalingWithIoRegistrationLifecycle() 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