Home / Function/ testSuspendingWhileRegistrationActive() — netty Function Reference

testSuspendingWhileRegistrationActive() — netty Function Reference

Architecture documentation for the testSuspendingWhileRegistrationActive() function in SingleThreadIoEventLoopTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  150f9b58_d062_6dfa_329b_040b38e2d740["testSuspendingWhileRegistrationActive()"]
  3ae7759e_3f36_7ed2_6a26_d7826488440e["SingleThreadIoEventLoopTest"]
  150f9b58_d062_6dfa_329b_040b38e2d740 -->|defined in| 3ae7759e_3f36_7ed2_6a26_d7826488440e
  dbbf11c7_680e_a4d1_bfff_dffb597b6be1["TestIoHandler()"]
  150f9b58_d062_6dfa_329b_040b38e2d740 -->|calls| dbbf11c7_680e_a4d1_bfff_dffb597b6be1
  a1354934_926e_aada_6f27_8fff864da4a9["isCompatible()"]
  150f9b58_d062_6dfa_329b_040b38e2d740 -->|calls| a1354934_926e_aada_6f27_8fff864da4a9
  style 150f9b58_d062_6dfa_329b_040b38e2d740 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/SingleThreadIoEventLoopTest.java lines 79–107

    @Disabled("This test is flaky and will often stall the build")
    @Test
    void testSuspendingWhileRegistrationActive() throws Exception {
        TestThreadFactory threadFactory = new TestThreadFactory();
        IoEventLoop loop = new SingleThreadIoEventLoop(null, threadFactory,
                eventLoop -> new TestIoHandler(eventLoop) {
            @Override
            public boolean isCompatible(Class<? extends IoHandle> handleType) {
                return true;
            }
        });
        assertFalse(loop.isSuspended());
        IoRegistration registration = loop.register(new TestIoHandle()).sync().getNow();
        Thread currentThread = threadFactory.threads.take();
        assertTrue(currentThread.isAlive());
        assertTrue(loop.trySuspend());

        // Still should be alive as until the registration is cancelled we can not suspend the loop.
        assertTrue(currentThread.isAlive());

        registration.cancel();
        assertFalse(registration.isValid());

        // The current thread should be able to die now.
        currentThread.join();

        assertTrue(threadFactory.threads.isEmpty());
        loop.shutdownGracefully();
    }

Domain

Subdomains

Frequently Asked Questions

What does testSuspendingWhileRegistrationActive() do?
testSuspendingWhileRegistrationActive() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/SingleThreadIoEventLoopTest.java.
Where is testSuspendingWhileRegistrationActive() defined?
testSuspendingWhileRegistrationActive() is defined in transport/src/test/java/io/netty/channel/SingleThreadIoEventLoopTest.java at line 79.
What does testSuspendingWhileRegistrationActive() call?
testSuspendingWhileRegistrationActive() calls 2 function(s): TestIoHandler, isCompatible.

Analyze Your Own Codebase

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

Try Supermodel Free