Home / Function/ testInEventLoopAfterReschedulingFailure() — netty Function Reference

testInEventLoopAfterReschedulingFailure() — netty Function Reference

Architecture documentation for the testInEventLoopAfterReschedulingFailure() function in NonStickyEventExecutorGroupTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  14b687f0_1586_e71c_9bd1_aa3dff7998ea["testInEventLoopAfterReschedulingFailure()"]
  d2c2f535_6e38_2696_75d2_7afac99b078a["NonStickyEventExecutorGroupTest"]
  14b687f0_1586_e71c_9bd1_aa3dff7998ea -->|defined in| d2c2f535_6e38_2696_75d2_7afac99b078a
  d369a955_11b2_c7ca_40f7_c70d0810e451["execute()"]
  14b687f0_1586_e71c_9bd1_aa3dff7998ea -->|calls| d369a955_11b2_c7ca_40f7_c70d0810e451
  style 14b687f0_1586_e71c_9bd1_aa3dff7998ea fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/test/java/io/netty/util/concurrent/NonStickyEventExecutorGroupTest.java lines 136–281

    @Test
    public void testInEventLoopAfterReschedulingFailure() throws Exception {
        final UnorderedThreadPoolEventExecutor underlying = new UnorderedThreadPoolEventExecutor(1);
        final AtomicInteger executeCount = new AtomicInteger();

        final EventExecutorGroup wrapper = new AbstractEventExecutorGroup() {
            @Override
            public void shutdown() {
                shutdownGracefully();
            }

            private final EventExecutor executor = new AbstractEventExecutor(this) {
                @Override
                public boolean inEventLoop(Thread thread) {
                    return underlying.inEventLoop(thread);
                }

                @Override
                public void shutdown() {
                    shutdownGracefully();
                }

                @Override
                public void execute(Runnable command) {
                    // Reject the 2nd execute() call (the reschedule attempt)
                    // 1st call: initial task submission
                    // 2nd call: reschedule after maxTaskExecutePerRun
                    if (executeCount.incrementAndGet() == 2) {
                        throw new RejectedExecutionException("Simulated queue full");
                    }
                    underlying.execute(command);
                }

                @Override
                public boolean isShuttingDown() {
                    return underlying.isShuttingDown();
                }

                @Override
                public Future<?> shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit) {
                    return underlying.shutdownGracefully(quietPeriod, timeout, unit);
                }

                @Override
                public Future<?> terminationFuture() {
                    return underlying.terminationFuture();
                }

                @Override
                public boolean isShutdown() {
                    return underlying.isShutdown();
                }

                @Override
                public boolean isTerminated() {
                    return underlying.isTerminated();
                }

                @Override
                public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
                    return underlying.awaitTermination(timeout, unit);
                }
            };

            @Override
            public EventExecutor next() {
                return executor;
            }

            @Override
            public Iterator<EventExecutor> iterator() {
                return Collections.singletonList(executor).iterator();
            }

            @Override
            public boolean isShuttingDown() {
                return underlying.isShuttingDown();
            }

            @Override
            public Future<?> shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit) {

Domain

Subdomains

Calls

Frequently Asked Questions

What does testInEventLoopAfterReschedulingFailure() do?
testInEventLoopAfterReschedulingFailure() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/concurrent/NonStickyEventExecutorGroupTest.java.
Where is testInEventLoopAfterReschedulingFailure() defined?
testInEventLoopAfterReschedulingFailure() is defined in common/src/test/java/io/netty/util/concurrent/NonStickyEventExecutorGroupTest.java at line 136.
What does testInEventLoopAfterReschedulingFailure() call?
testInEventLoopAfterReschedulingFailure() calls 1 function(s): execute.

Analyze Your Own Codebase

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

Try Supermodel Free