Home / Function/ testWrapMany() — netty Function Reference

testWrapMany() — netty Function Reference

Architecture documentation for the testWrapMany() function in FastThreadLocalTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  6ab9cb4b_b38c_1251_6260_1991db795321["testWrapMany()"]
  c9cb652b_4141_8af2_1f8b_c47765bb30f9["FastThreadLocalTest"]
  6ab9cb4b_b38c_1251_6260_1991db795321 -->|defined in| c9cb652b_4141_8af2_1f8b_c47765bb30f9
  7fb6cd58_f112_73b3_6216_2819f285c975["run()"]
  6ab9cb4b_b38c_1251_6260_1991db795321 -->|calls| 7fb6cd58_f112_73b3_6216_2819f285c975
  style 6ab9cb4b_b38c_1251_6260_1991db795321 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/test/java/io/netty/util/concurrent/FastThreadLocalTest.java lines 200–242

    @Test
    public void testWrapMany() throws ExecutionException, InterruptedException {
        class Worker implements Runnable {
            final Semaphore semaphore = new Semaphore(0);
            final FutureTask<?> task = new FutureTask<>(this, null);

            @Override
            public void run() {
                assertFalse(FastThreadLocalThread.currentThreadWillCleanupFastThreadLocals());
                assertFalse(FastThreadLocalThread.currentThreadHasFastThreadLocal());
                semaphore.acquireUninterruptibly();
                FastThreadLocalThread.runWithFastThreadLocal(() -> {
                    assertTrue(FastThreadLocalThread.currentThreadWillCleanupFastThreadLocals());
                    assertTrue(FastThreadLocalThread.currentThreadHasFastThreadLocal());
                    semaphore.acquireUninterruptibly();
                    assertTrue(FastThreadLocalThread.currentThreadWillCleanupFastThreadLocals());
                    assertTrue(FastThreadLocalThread.currentThreadHasFastThreadLocal());
                });
                assertFalse(FastThreadLocalThread.currentThreadWillCleanupFastThreadLocals());
                assertFalse(FastThreadLocalThread.currentThreadHasFastThreadLocal());
            }
        }

        int n = 100;
        List<Worker> workers = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            Worker worker = new Worker();
            workers.add(worker);
        }
        Collections.shuffle(workers);
        for (int i = 0; i < workers.size(); i++) {
            new Thread(workers.get(i).task, "worker-" + i).start();
        }
        for (int i = 0; i < 2; i++) {
            Collections.shuffle(workers);
            for (Worker worker : workers) {
                worker.semaphore.release();
            }
        }
        for (Worker worker : workers) {
            worker.task.get();
        }
    }

Domain

Subdomains

Calls

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free