Home / Function/ testSmarterPickingConsolidatesWorkOnActiveExecutor() — netty Function Reference

testSmarterPickingConsolidatesWorkOnActiveExecutor() — netty Function Reference

Architecture documentation for the testSmarterPickingConsolidatesWorkOnActiveExecutor() function in AutoScalingEventExecutorChooserFactoryTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ece7134e_ee36_459c_5aa3_071609b9fe1d["testSmarterPickingConsolidatesWorkOnActiveExecutor()"]
  b457a618_1afa_e8a9_dd34_152c53154c93["AutoScalingEventExecutorChooserFactoryTest"]
  ece7134e_ee36_459c_5aa3_071609b9fe1d -->|defined in| b457a618_1afa_e8a9_dd34_152c53154c93
  451cbcf6_6cbf_b404_e07f_191549368cc2["TestEventExecutorGroup()"]
  ece7134e_ee36_459c_5aa3_071609b9fe1d -->|calls| 451cbcf6_6cbf_b404_e07f_191549368cc2
  70a22675_9cb3_276f_a519_80257cc8a1a0["startAllExecutors()"]
  ece7134e_ee36_459c_5aa3_071609b9fe1d -->|calls| 70a22675_9cb3_276f_a519_80257cc8a1a0
  style ece7134e_ee36_459c_5aa3_071609b9fe1d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/test/java/io/netty/util/concurrent/AutoScalingEventExecutorChooserFactoryTest.java lines 245–271

    @Test
    @Timeout(30)
    void testSmarterPickingConsolidatesWorkOnActiveExecutor() throws InterruptedException {
        TestEventExecutorGroup group = new TestEventExecutorGroup(1, 3, 50, TimeUnit.MILLISECONDS);
        try {
            startAllExecutors(group);

            long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(5);
            while (group.activeExecutorCount() > 1 && System.nanoTime() < deadline) {
                Thread.sleep(50);
            }
            assertEquals(1, group.activeExecutorCount(),
                         "Group should scale down to 1 active executor");

            // Simulate a slow trickle of new work (e.g., new connections) by calling next() a few times.
            for (int i = 0; i < 5; i++) {
                group.next().execute(() -> { });
                Thread.sleep(20);
            }

            assertEquals(1, group.activeExecutorCount(),
                         "Should consolidate the trickle of work onto the single active executor, without" +
                         " waking up the suspended ones");
        } finally {
            group.shutdownGracefully().syncUninterruptibly();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testSmarterPickingConsolidatesWorkOnActiveExecutor() do?
testSmarterPickingConsolidatesWorkOnActiveExecutor() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/concurrent/AutoScalingEventExecutorChooserFactoryTest.java.
Where is testSmarterPickingConsolidatesWorkOnActiveExecutor() defined?
testSmarterPickingConsolidatesWorkOnActiveExecutor() is defined in common/src/test/java/io/netty/util/concurrent/AutoScalingEventExecutorChooserFactoryTest.java at line 245.
What does testSmarterPickingConsolidatesWorkOnActiveExecutor() call?
testSmarterPickingConsolidatesWorkOnActiveExecutor() calls 2 function(s): TestEventExecutorGroup, startAllExecutors.

Analyze Your Own Codebase

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

Try Supermodel Free