Home / Function/ testMultipleRecycleRacing() — netty Function Reference

testMultipleRecycleRacing() — netty Function Reference

Architecture documentation for the testMultipleRecycleRacing() function in RecyclerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4c48b5d2_b8b5_b740_21d9_b4564924f5a5["testMultipleRecycleRacing()"]
  46ac14b1_2382_5afa_98f3_803182070b38["RecyclerTest"]
  4c48b5d2_b8b5_b740_21d9_b4564924f5a5 -->|defined in| 46ac14b1_2382_5afa_98f3_803182070b38
  87dca999_f804_a974_e326_fd8f527f1246["newRecycler()"]
  4c48b5d2_b8b5_b740_21d9_b4564924f5a5 -->|calls| 87dca999_f804_a974_e326_fd8f527f1246
  43ab40f6_52e7_0fe9_a79f_220021939268["recycle()"]
  4c48b5d2_b8b5_b740_21d9_b4564924f5a5 -->|calls| 43ab40f6_52e7_0fe9_a79f_220021939268
  style 4c48b5d2_b8b5_b740_21d9_b4564924f5a5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/test/java/io/netty/util/RecyclerTest.java lines 340–385

    @ParameterizedTest
    @EnumSource(OwnerType.class)
    public void testMultipleRecycleRacing(OwnerType ownerType) throws InterruptedException {
        // This test makes only sense for guarded recyclers
        Recycler<HandledObject> recycler = newRecycler(ownerType, false, 1024);
        final HandledObject object = recycler.get();
        final AtomicReference<IllegalStateException> exceptionStore = new AtomicReference<IllegalStateException>();

        final CountDownLatch countDownLatch = new CountDownLatch(1);
        final Thread thread1 = newThread(new Runnable() {
            @Override
            public void run() {
                try {
                    object.recycle();
                } catch (IllegalStateException e) {
                    Exception x = exceptionStore.getAndSet(e);
                    if (x != null) {
                        e.addSuppressed(x);
                    }
                } finally {
                    countDownLatch.countDown();
                }
            }
        });
        thread1.start();

        try {
            object.recycle();
        } catch (IllegalStateException e) {
            Exception x = exceptionStore.getAndSet(e);
            if (x != null) {
                e.addSuppressed(x);
            }
        }

        try {
            countDownLatch.await();
            HandledObject a = recycler.get();
            HandledObject b = recycler.get();
            assertNotSame(a, b);
            IllegalStateException exception = exceptionStore.get();
            assertNotNull(exception); // Object got recycled twice, so at least one of the calls must throw.
        } finally {
            thread1.join(1000);
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testMultipleRecycleRacing() do?
testMultipleRecycleRacing() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/RecyclerTest.java.
Where is testMultipleRecycleRacing() defined?
testMultipleRecycleRacing() is defined in common/src/test/java/io/netty/util/RecyclerTest.java at line 340.
What does testMultipleRecycleRacing() call?
testMultipleRecycleRacing() calls 2 function(s): newRecycler, recycle.

Analyze Your Own Codebase

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

Try Supermodel Free