Home / Function/ testInvokeInEventLoop() — netty Function Reference

testInvokeInEventLoop() — netty Function Reference

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

Function java Buffer Search calls 1 called by 4

Entity Profile

Dependency Diagram

graph TD
  2074a46e_da44_0185_8b5f_faf9b78d6aa0["testInvokeInEventLoop()"]
  bbf4ea8d_698f_542a_1559_437b1b237a04["SingleThreadEventExecutorTest"]
  2074a46e_da44_0185_8b5f_faf9b78d6aa0 -->|defined in| bbf4ea8d_698f_542a_1559_437b1b237a04
  2634351a_7ff9_b82e_bcee_1c2dd769eaa6["testInvokeAnyInEventLoop()"]
  2634351a_7ff9_b82e_bcee_1c2dd769eaa6 -->|calls| 2074a46e_da44_0185_8b5f_faf9b78d6aa0
  3d50b8a6_c8c4_64d9_388d_272fd712d181["testInvokeAnyInEventLoopWithTimeout()"]
  3d50b8a6_c8c4_64d9_388d_272fd712d181 -->|calls| 2074a46e_da44_0185_8b5f_faf9b78d6aa0
  4207a2c6_dde6_32e9_0e6f_e6aed99e0f26["testInvokeAllInEventLoop()"]
  4207a2c6_dde6_32e9_0e6f_e6aed99e0f26 -->|calls| 2074a46e_da44_0185_8b5f_faf9b78d6aa0
  4365b07d_2f97_d255_0545_65991544e68b["testInvokeAllInEventLoopWithTimeout()"]
  4365b07d_2f97_d255_0545_65991544e68b -->|calls| 2074a46e_da44_0185_8b5f_faf9b78d6aa0
  d1474077_6d3a_87c2_2d11_070af739005b["run()"]
  2074a46e_da44_0185_8b5f_faf9b78d6aa0 -->|calls| d1474077_6d3a_87c2_2d11_070af739005b
  style 2074a46e_da44_0185_8b5f_faf9b78d6aa0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/test/java/io/netty/util/concurrent/SingleThreadEventExecutorTest.java lines 345–400

    private static void testInvokeInEventLoop(final boolean any, final boolean timeout) {
        final SingleThreadEventExecutor executor = new SingleThreadEventExecutor(null,
                Executors.defaultThreadFactory(), true) {
            @Override
            protected void run() {
                while (!confirmShutdown()) {
                    Runnable task = takeTask();
                    if (task != null) {
                        task.run();
                    }
                }
            }
        };
        try {
            assertThrows(RejectedExecutionException.class, new Executable() {
                @Override
                public void execute() throws Throwable {
                    final Promise<Void> promise = executor.newPromise();
                    executor.execute(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                Set<Callable<Boolean>> set = Collections.<Callable<Boolean>>singleton(
                                        new Callable<Boolean>() {
                                    @Override
                                    public Boolean call() throws Exception {
                                        promise.setFailure(new AssertionError("Should never execute the Callable"));
                                        return Boolean.TRUE;
                                    }
                                });
                                if (any) {
                                    if (timeout) {
                                        executor.invokeAny(set, 10, TimeUnit.SECONDS);
                                    } else {
                                        executor.invokeAny(set);
                                    }
                                } else {
                                    if (timeout) {
                                        executor.invokeAll(set, 10, TimeUnit.SECONDS);
                                    } else {
                                        executor.invokeAll(set);
                                    }
                                }
                                promise.setFailure(new AssertionError("Should never reach here"));
                            } catch (Throwable cause) {
                                promise.setFailure(cause);
                            }
                        }
                    });
                    promise.syncUninterruptibly();
                }
            });
        } finally {
            executor.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS).syncUninterruptibly();
        }
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does testInvokeInEventLoop() do?
testInvokeInEventLoop() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/concurrent/SingleThreadEventExecutorTest.java.
Where is testInvokeInEventLoop() defined?
testInvokeInEventLoop() is defined in common/src/test/java/io/netty/util/concurrent/SingleThreadEventExecutorTest.java at line 345.
What does testInvokeInEventLoop() call?
testInvokeInEventLoop() calls 1 function(s): 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