Home / Function/ testSubmittingTaskWakesUpSuspendedExecutor() — netty Function Reference

testSubmittingTaskWakesUpSuspendedExecutor() — netty Function Reference

Architecture documentation for the testSubmittingTaskWakesUpSuspendedExecutor() function in AbstractSingleThreadEventLoopTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  66fad147_d183_9f96_d6c8_126aa6f58b69["testSubmittingTaskWakesUpSuspendedExecutor()"]
  eb487d77_b896_e5c3_20f1_2b7144dc7cf5["AbstractSingleThreadEventLoopTest"]
  66fad147_d183_9f96_d6c8_126aa6f58b69 -->|defined in| eb487d77_b896_e5c3_20f1_2b7144dc7cf5
  a63bc263_a646_b09f_b2cc_5f65bb9ee306["startAllExecutors()"]
  66fad147_d183_9f96_d6c8_126aa6f58b69 -->|calls| a63bc263_a646_b09f_b2cc_5f65bb9ee306
  8296623e_3a87_dc79_c117_7521904ea268["countActiveExecutors()"]
  66fad147_d183_9f96_d6c8_126aa6f58b69 -->|calls| 8296623e_3a87_dc79_c117_7521904ea268
  style 66fad147_d183_9f96_d6c8_126aa6f58b69 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/AbstractSingleThreadEventLoopTest.java lines 347–385

    @Test
    @Timeout(30)
    public void testSubmittingTaskWakesUpSuspendedExecutor() throws Exception {
        EventLoopGroup group = newAutoScalingEventLoopGroup();
        if (group == null) {
            return;
        }
        try {
            startAllExecutors(group);
            assertEquals(SCALING_MAX_THREADS, countActiveExecutors(group),
                         "Group should start with max threads.");

            long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(10);
            while (countActiveExecutors(group) > SCALING_MIN_THREADS && System.nanoTime() < deadline) {
                Thread.sleep(100);
            }
            assertEquals(SCALING_MIN_THREADS, countActiveExecutors(group),
                         "Group did not scale down to min threads in time.");

            EventLoop suspendedLoop = null;
            for (EventExecutor exec : group) {
                if (exec.isSuspended()) {
                    suspendedLoop = (EventLoop) exec;
                    break;
                }
            }
            assertNotNull(suspendedLoop, "Could not find a suspended executor to test.");

            // Submit a task directly to the suspended loop, this should trigger the wake-up mechanism.
            Future<?> future = suspendedLoop.submit(() -> { });
            future.syncUninterruptibly();

            assertFalse(suspendedLoop.isSuspended(), "Executor should wake up after task submission.");
            assertEquals(SCALING_MAX_THREADS, countActiveExecutors(group),
                         "Active executor count should increase after wake-up.");
        } finally {
            group.shutdownGracefully().syncUninterruptibly();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testSubmittingTaskWakesUpSuspendedExecutor() do?
testSubmittingTaskWakesUpSuspendedExecutor() is a function in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/AbstractSingleThreadEventLoopTest.java.
Where is testSubmittingTaskWakesUpSuspendedExecutor() defined?
testSubmittingTaskWakesUpSuspendedExecutor() is defined in testsuite/src/main/java/io/netty/testsuite/transport/AbstractSingleThreadEventLoopTest.java at line 347.
What does testSubmittingTaskWakesUpSuspendedExecutor() call?
testSubmittingTaskWakesUpSuspendedExecutor() calls 2 function(s): countActiveExecutors, startAllExecutors.

Analyze Your Own Codebase

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

Try Supermodel Free