Home / Function/ testRun() — netty Function Reference

testRun() — netty Function Reference

Architecture documentation for the testRun() function in ManualIoEventLoopTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e739f9a0_1481_b2ef_ca82_1e204cd89e8a["testRun()"]
  7f1091cc_a8b6_0293_92ad_d94222ae6482["ManualIoEventLoopTest"]
  e739f9a0_1481_b2ef_ca82_1e204cd89e8a -->|defined in| 7f1091cc_a8b6_0293_92ad_d94222ae6482
  3bf16ebe_cf8d_923f_9559_397075f9b2a1["TestIoHandler()"]
  e739f9a0_1481_b2ef_ca82_1e204cd89e8a -->|calls| 3bf16ebe_cf8d_923f_9559_397075f9b2a1
  a3e5c62f_e788_a2c4_0d6f_61347ddb0c79["isDone()"]
  e739f9a0_1481_b2ef_ca82_1e204cd89e8a -->|calls| a3e5c62f_e788_a2c4_0d6f_61347ddb0c79
  a184d64e_5ebb_5009_edad_a36cf4e3aea8["run()"]
  e739f9a0_1481_b2ef_ca82_1e204cd89e8a -->|calls| a184d64e_5ebb_5009_edad_a36cf4e3aea8
  style e739f9a0_1481_b2ef_ca82_1e204cd89e8a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/ManualIoEventLoopTest.java lines 71–100

    @Test
    public void testRun() throws Exception {
        Thread currentThread = Thread.currentThread();
        Semaphore semaphore = new Semaphore(0);
        ManualIoEventLoop eventLoop = new ManualIoEventLoop(currentThread, executor ->
                new TestIoHandler(semaphore));

        long waitTime = TimeUnit.MILLISECONDS.toNanos(200);
        long current = System.nanoTime();
        assertEquals(0, eventLoop.run(waitTime));
        long actualNanos = System.nanoTime() - current;
        assertThat(actualNanos).isGreaterThanOrEqualTo(waitTime);

        TestRunnable runnable = new TestRunnable();
        eventLoop.execute(runnable);
        assertFalse(runnable.isDone());

        waitTime = TimeUnit.SECONDS.toNanos(1);
        current = System.nanoTime();
        assertEquals(1, eventLoop.run(waitTime));
        assertThat(waitTime).isGreaterThan(System.nanoTime() - current);

        assertTrue(runnable.isDone());
        eventLoop.shutdown();

        while (!eventLoop.isTerminated()) {
            eventLoop.runNow();
        }
        eventLoop.terminationFuture().sync();
    }

Domain

Subdomains

Frequently Asked Questions

What does testRun() do?
testRun() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/ManualIoEventLoopTest.java.
Where is testRun() defined?
testRun() is defined in transport/src/test/java/io/netty/channel/ManualIoEventLoopTest.java at line 71.
What does testRun() call?
testRun() calls 3 function(s): TestIoHandler, isDone, run.

Analyze Your Own Codebase

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

Try Supermodel Free