Home / Function/ testConcurrentUsage() — netty Function Reference

testConcurrentUsage() — netty Function Reference

Architecture documentation for the testConcurrentUsage() function in PooledByteBufAllocatorTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  df6170b5_52a9_f3ad_7655_7d0e8f7fea0b["testConcurrentUsage()"]
  f8855572_2abf_1bf6_a32b_5cf6d1cf4947["PooledByteBufAllocatorTest"]
  df6170b5_52a9_f3ad_7655_7d0e8f7fea0b -->|defined in| f8855572_2abf_1bf6_a32b_5cf6d1cf4947
  4e681469_9c14_67cb_5890_46b5d4b12dd2["PooledByteBufAllocator()"]
  df6170b5_52a9_f3ad_7655_7d0e8f7fea0b -->|calls| 4e681469_9c14_67cb_5890_46b5d4b12dd2
  46e263fa_fdc3_660c_4ebd_463688b0b22c["AllocationThread()"]
  df6170b5_52a9_f3ad_7655_7d0e8f7fea0b -->|calls| 46e263fa_fdc3_660c_4ebd_463688b0b22c
  152eb98f_e40e_756f_9db7_3fe4f4911a8b["isExpired()"]
  df6170b5_52a9_f3ad_7655_7d0e8f7fea0b -->|calls| 152eb98f_e40e_756f_9db7_3fe4f4911a8b
  bfa1f5a5_dead_b949_f82d_244f64efb5d5["checkForErrors()"]
  df6170b5_52a9_f3ad_7655_7d0e8f7fea0b -->|calls| bfa1f5a5_dead_b949_f82d_244f64efb5d5
  ae2cbede_690d_b607_b7fd_b0b04f28d215["markAsFinished()"]
  df6170b5_52a9_f3ad_7655_7d0e8f7fea0b -->|calls| ae2cbede_690d_b607_b7fd_b0b04f28d215
  f49c8d97_9572_ea44_eea5_b4423389718a["joinAndCheckForError()"]
  df6170b5_52a9_f3ad_7655_7d0e8f7fea0b -->|calls| f49c8d97_9572_ea44_eea5_b4423389718a
  style df6170b5_52a9_f3ad_7655_7d0e8f7fea0b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/PooledByteBufAllocatorTest.java lines 557–589

    @Test
    public void testConcurrentUsage() throws Throwable {
        long runningTime = MILLISECONDS.toNanos(SystemPropertyUtil.getLong(
                "io.netty.buffer.PooledByteBufAllocatorTest.testConcurrentUsageTime", 15000));

        // We use no caches and only one arena to maximize the chance of hitting the race-condition we
        // had before.
        ByteBufAllocator allocator = new PooledByteBufAllocator(true, 0, 1, 8192, 9, 0, 0, 0);
        List<AllocationThread> threads = new ArrayList<AllocationThread>();
        try {
            for (int i = 0; i < 64; i++) {
                AllocationThread thread = new AllocationThread(allocator);
                thread.start();
                threads.add(thread);
            }

            long start = System.nanoTime();
            while (!isExpired(start, runningTime)) {
                checkForErrors(threads);
                Thread.sleep(100);
            }
        } finally {
            // First mark all AllocationThreads to complete their work and then wait until these are complete
            // and rethrow if there was any error.
            for (AllocationThread t : threads) {
                t.markAsFinished();
            }

            for (AllocationThread t: threads) {
                t.joinAndCheckForError();
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testConcurrentUsage() do?
testConcurrentUsage() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/PooledByteBufAllocatorTest.java.
Where is testConcurrentUsage() defined?
testConcurrentUsage() is defined in buffer/src/test/java/io/netty/buffer/PooledByteBufAllocatorTest.java at line 557.
What does testConcurrentUsage() call?
testConcurrentUsage() calls 6 function(s): AllocationThread, PooledByteBufAllocator, checkForErrors, isExpired, joinAndCheckForError, markAsFinished.

Analyze Your Own Codebase

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

Try Supermodel Free