Home / Function/ testRefCnt0() — netty Function Reference

testRefCnt0() — netty Function Reference

Architecture documentation for the testRefCnt0() function in AbstractByteBufTest.java from the netty codebase.

Function java Buffer Search called by 2

Entity Profile

Dependency Diagram

graph TD
  f265bcaa_e892_b2de_7898_79d061f5e410["testRefCnt0()"]
  6540f2d1_cdad_6705_dd1d_9a24e2e53242["AbstractByteBufTest"]
  f265bcaa_e892_b2de_7898_79d061f5e410 -->|defined in| 6540f2d1_cdad_6705_dd1d_9a24e2e53242
  27a44d4f_296b_a0ed_96e9_8409c0514ba9["testRefCnt()"]
  27a44d4f_296b_a0ed_96e9_8409c0514ba9 -->|calls| f265bcaa_e892_b2de_7898_79d061f5e410
  3a691299_7e61_9c65_581c_f8713a3410c2["testRefCnt2()"]
  3a691299_7e61_9c65_581c_f8713a3410c2 -->|calls| f265bcaa_e892_b2de_7898_79d061f5e410
  style f265bcaa_e892_b2de_7898_79d061f5e410 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java lines 5980–6020

    private void testRefCnt0(final boolean parameter) throws Exception {
        for (int i = 0; i < 10; i++) {
            final CountDownLatch latch = new CountDownLatch(1);
            final CountDownLatch innerLatch = new CountDownLatch(1);

            final ByteBuf buffer = newBuffer(4);
            assertEquals(1, buffer.refCnt());
            final AtomicInteger cnt = new AtomicInteger(Integer.MAX_VALUE);
            Thread t1 = new Thread(new Runnable() {
                @Override
                public void run() {
                    boolean released;
                    if (parameter) {
                        released = buffer.release(buffer.refCnt());
                    } else {
                        released = buffer.release();
                    }
                    assertTrue(released);
                    Thread t2 = new Thread(new Runnable() {
                        @Override
                        public void run() {
                            cnt.set(buffer.refCnt());
                            latch.countDown();
                        }
                    });
                    t2.start();
                    try {
                        // Keep Thread alive a bit so the ThreadLocal caches are not freed
                        innerLatch.await();
                    } catch (InterruptedException ignore) {
                        // ignore
                    }
                }
            });
            t1.start();

            latch.await();
            assertEquals(0, cnt.get());
            innerLatch.countDown();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testRefCnt0() do?
testRefCnt0() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java.
Where is testRefCnt0() defined?
testRefCnt0() is defined in buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java at line 5980.
What calls testRefCnt0()?
testRefCnt0() is called by 2 function(s): testRefCnt, testRefCnt2.

Analyze Your Own Codebase

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

Try Supermodel Free