Home / Function/ execute() — netty Function Reference

execute() — netty Function Reference

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

Function java Buffer Search called by 4

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

common/src/test/java/io/netty/util/concurrent/NonStickyEventExecutorGroupTest.java lines 283–328

    private static void execute(EventExecutorGroup group, CountDownLatch startLatch) throws Throwable {
        final EventExecutor executor = group.next();
        assertTrue(executor instanceof OrderedEventExecutor);
        final AtomicReference<Throwable> cause = new AtomicReference<Throwable>();
        final AtomicInteger last = new AtomicInteger();
        int tasks = 10000;
        List<Future<?>> futures = new ArrayList<Future<?>>(tasks);
        final CountDownLatch latch = new CountDownLatch(tasks);
        startLatch.await();

        for (int i = 1 ; i <= tasks; i++) {
            final int id = i;
            assertFalse(executor.inEventLoop());
            assertFalse(executor.inEventLoop(Thread.currentThread()));
            futures.add(executor.submit(new Runnable() {
                @Override
                public void run() {
                    try {
                        assertTrue(executor.inEventLoop(Thread.currentThread()));
                        assertTrue(executor.inEventLoop());

                        if (cause.get() == null) {
                            int lastId = last.get();
                            if (lastId >= id) {
                                cause.compareAndSet(null, new AssertionError(
                                        "Out of order execution id(" + id + ") >= lastId(" + lastId + ')'));
                            }
                            if (!last.compareAndSet(lastId, id)) {
                                cause.compareAndSet(null, new AssertionError("Concurrent execution of tasks"));
                            }
                        }
                    } finally {
                        latch.countDown();
                    }
                }
            }));
        }
        latch.await();
        for (Future<?> future: futures) {
            future.syncUninterruptibly();
        }
        Throwable error = cause.get();
        if (error != null) {
            throw error;
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does execute() do?
execute() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/concurrent/NonStickyEventExecutorGroupTest.java.
Where is execute() defined?
execute() is defined in common/src/test/java/io/netty/util/concurrent/NonStickyEventExecutorGroupTest.java at line 283.
What calls execute()?
execute() is called by 4 function(s): testInEventLoopAfterReschedulingFailure, testInvalidGroup, testOrdering, testRaceCondition.

Analyze Your Own Codebase

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

Try Supermodel Free