Home / Function/ testInvokeInEventLoop() — netty Function Reference

testInvokeInEventLoop() — netty Function Reference

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

Function java Buffer Search calls 3 called by 4

Entity Profile

Dependency Diagram

graph TD
  9ad20f38_37d5_14b6_eb18_e8d259bdc892["testInvokeInEventLoop()"]
  7f1091cc_a8b6_0293_92ad_d94222ae6482["ManualIoEventLoopTest"]
  9ad20f38_37d5_14b6_eb18_e8d259bdc892 -->|defined in| 7f1091cc_a8b6_0293_92ad_d94222ae6482
  92aa0cf7_6242_9c82_1fe1_efde7189f5ee["testInvokeAnyInEventLoop()"]
  92aa0cf7_6242_9c82_1fe1_efde7189f5ee -->|calls| 9ad20f38_37d5_14b6_eb18_e8d259bdc892
  d5f4b237_d3ab_bffd_c765_25e5392a2ea6["testInvokeAnyInEventLoopWithTimeout()"]
  d5f4b237_d3ab_bffd_c765_25e5392a2ea6 -->|calls| 9ad20f38_37d5_14b6_eb18_e8d259bdc892
  b3bf2f83_68f3_fe0d_972a_cffaa3fb0292["testInvokeAllInEventLoop()"]
  b3bf2f83_68f3_fe0d_972a_cffaa3fb0292 -->|calls| 9ad20f38_37d5_14b6_eb18_e8d259bdc892
  5f7a7480_bd27_aa34_919f_5bcce8ebcc58["testInvokeAllInEventLoopWithTimeout()"]
  5f7a7480_bd27_aa34_919f_5bcce8ebcc58 -->|calls| 9ad20f38_37d5_14b6_eb18_e8d259bdc892
  3bf16ebe_cf8d_923f_9559_397075f9b2a1["TestIoHandler()"]
  9ad20f38_37d5_14b6_eb18_e8d259bdc892 -->|calls| 3bf16ebe_cf8d_923f_9559_397075f9b2a1
  a3e5c62f_e788_a2c4_0d6f_61347ddb0c79["isDone()"]
  9ad20f38_37d5_14b6_eb18_e8d259bdc892 -->|calls| a3e5c62f_e788_a2c4_0d6f_61347ddb0c79
  a184d64e_5ebb_5009_edad_a36cf4e3aea8["run()"]
  9ad20f38_37d5_14b6_eb18_e8d259bdc892 -->|calls| a184d64e_5ebb_5009_edad_a36cf4e3aea8
  style 9ad20f38_37d5_14b6_eb18_e8d259bdc892 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/ManualIoEventLoopTest.java lines 167–221

    private static void testInvokeInEventLoop(final boolean any, final boolean timeout) {
        Semaphore semaphore = new Semaphore(0);
        ManualIoEventLoop eventLoop = new ManualIoEventLoop(Thread.currentThread(), executor ->
                new TestIoHandler(semaphore));
        try {
            assertThrows(RejectedExecutionException.class, new Executable() {
                @Override
                public void execute() throws Throwable {
                    final Promise<Void> promise = eventLoop.newPromise();
                    eventLoop.execute(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                Set<Callable<Boolean>> set = Collections.<Callable<Boolean>>singleton(
                                        new Callable<Boolean>() {
                                            @Override
                                            public Boolean call() {
                                                promise.setFailure(
                                                        new AssertionError("Should never execute the Callable"));
                                                return Boolean.TRUE;
                                            }
                                        });
                                if (any) {
                                    if (timeout) {
                                        eventLoop.invokeAny(set, 10, TimeUnit.SECONDS);
                                    } else {
                                        eventLoop.invokeAny(set);
                                    }
                                } else {
                                    if (timeout) {
                                        eventLoop.invokeAll(set, 10, TimeUnit.SECONDS);
                                    } else {
                                        eventLoop.invokeAll(set);
                                    }
                                }
                                promise.setFailure(new AssertionError("Should never reach here"));
                            } catch (Throwable cause) {
                                promise.setFailure(cause);
                            }
                        }
                    });
                    while (!promise.isDone()) {
                        eventLoop.runNow();
                    }
                    promise.syncUninterruptibly();
                }
            });
        } finally {
            eventLoop.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS);
            while (!eventLoop.isTerminated()) {
                eventLoop.runNow();
            }
            assertTrue(eventLoop.terminationFuture().isSuccess());
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testInvokeInEventLoop() do?
testInvokeInEventLoop() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/ManualIoEventLoopTest.java.
Where is testInvokeInEventLoop() defined?
testInvokeInEventLoop() is defined in transport/src/test/java/io/netty/channel/ManualIoEventLoopTest.java at line 167.
What does testInvokeInEventLoop() call?
testInvokeInEventLoop() calls 3 function(s): TestIoHandler, isDone, run.
What calls testInvokeInEventLoop()?
testInvokeInEventLoop() is called by 4 function(s): testInvokeAllInEventLoop, testInvokeAllInEventLoopWithTimeout, testInvokeAnyInEventLoop, testInvokeAnyInEventLoopWithTimeout.

Analyze Your Own Codebase

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

Try Supermodel Free