Home / Function/ testMaxCapacityWithRecycleAtDifferentThread() — netty Function Reference

testMaxCapacityWithRecycleAtDifferentThread() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

common/src/test/java/io/netty/util/RecyclerTest.java lines 518–555

    @ParameterizedTest
    @MethodSource("notNoneOwnerAndUnguarded")
    public void testMaxCapacityWithRecycleAtDifferentThread(OwnerType ownerType, boolean unguarded) throws Exception {
        final int maxCapacity = 4;
        final Recycler<HandledObject> recycler = newRecycler(ownerType, unguarded, maxCapacity, 4, 4);

        // Borrow 2 * maxCapacity objects.
        // Return the half from the same thread.
        // Return the other half from the different thread.

        final HandledObject[] array = new HandledObject[maxCapacity * 3];
        for (int i = 0; i < array.length; i ++) {
            array[i] = recycler.get();
        }

        for (int i = 0; i < maxCapacity; i ++) {
            array[i].recycle();
        }

        final Thread thread = newThread(new Runnable() {
            @Override
            public void run() {
                for (int i1 = maxCapacity; i1 < array.length; i1++) {
                    array[i1].recycle();
                }
            }
        });
        thread.start();
        thread.join();

        assertEquals(maxCapacity * 3 / 4, recycler.threadLocalSize());

        for (int i = 0; i < array.length; i ++) {
            recycler.get();
        }

        assertEquals(0, recycler.threadLocalSize());
    }

Domain

Subdomains

Frequently Asked Questions

What does testMaxCapacityWithRecycleAtDifferentThread() do?
testMaxCapacityWithRecycleAtDifferentThread() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/RecyclerTest.java.
Where is testMaxCapacityWithRecycleAtDifferentThread() defined?
testMaxCapacityWithRecycleAtDifferentThread() is defined in common/src/test/java/io/netty/util/RecyclerTest.java at line 518.
What does testMaxCapacityWithRecycleAtDifferentThread() call?
testMaxCapacityWithRecycleAtDifferentThread() 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