Home / Function/ testCapacityChangeDoesntThrowAssertionError() — netty Function Reference

testCapacityChangeDoesntThrowAssertionError() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  881526d6_e286_dda2_f6c0_74e4e0ad5742["testCapacityChangeDoesntThrowAssertionError()"]
  f8855572_2abf_1bf6_a32b_5cf6d1cf4947["PooledByteBufAllocatorTest"]
  881526d6_e286_dda2_f6c0_74e4e0ad5742 -->|defined in| f8855572_2abf_1bf6_a32b_5cf6d1cf4947
  cedeec8b_9344_3cef_05a1_e0c94d65820e["run()"]
  881526d6_e286_dda2_f6c0_74e4e0ad5742 -->|calls| cedeec8b_9344_3cef_05a1_e0c94d65820e
  style 881526d6_e286_dda2_f6c0_74e4e0ad5742 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/PooledByteBufAllocatorTest.java lines 949–993

    @Test
    public void testCapacityChangeDoesntThrowAssertionError() throws Exception {
        ByteBufAllocator allocator = newAllocator(true);
        List<ByteBuf> buffers = new ArrayList<ByteBuf>();
        try {
            for (int i = 0; i < 31; i++) {
                buffers.add(allocator.heapBuffer());
            }

            final ByteBuf buf = allocator.heapBuffer();
            buffers.add(buf);
            final AtomicReference<AssertionError> assertionRef = new AtomicReference<AssertionError>();
            Runnable capacityChangeTask = new Runnable() {
                @Override
                public void run() {
                    try {
                        buf.capacity(512);
                    } catch (AssertionError e) {
                        assertionRef.compareAndSet(null, e);
                        throw e;
                    }
                }
            };
            Thread thread1 = new Thread(capacityChangeTask);
            Thread thread2 = new Thread(capacityChangeTask);

            thread1.start();
            thread2.start();

            thread1.join();
            thread2.join();

            buffers.add(allocator.heapBuffer());
            buffers.add(allocator.heapBuffer());

            AssertionError error = assertionRef.get();
            if (error != null) {
                throw error;
            }
        } finally {
            for (ByteBuf buffer: buffers) {
                buffer.release();
            }
        }
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does testCapacityChangeDoesntThrowAssertionError() do?
testCapacityChangeDoesntThrowAssertionError() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/PooledByteBufAllocatorTest.java.
Where is testCapacityChangeDoesntThrowAssertionError() defined?
testCapacityChangeDoesntThrowAssertionError() is defined in buffer/src/test/java/io/netty/buffer/PooledByteBufAllocatorTest.java at line 949.
What does testCapacityChangeDoesntThrowAssertionError() call?
testCapacityChangeDoesntThrowAssertionError() 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