Home / Function/ testReleasesOnShrink() — netty Function Reference

testReleasesOnShrink() — netty Function Reference

Architecture documentation for the testReleasesOnShrink() function in AbstractCompositeByteBufTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e2f861c2_45f5_ccca_bd0c_2e50e4396350["testReleasesOnShrink()"]
  47bc0a20_e243_89ff_132b_99ac6b23835f["AbstractCompositeByteBufTest"]
  e2f861c2_45f5_ccca_bd0c_2e50e4396350 -->|defined in| 47bc0a20_e243_89ff_132b_99ac6b23835f
  style e2f861c2_45f5_ccca_bd0c_2e50e4396350 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/AbstractCompositeByteBufTest.java lines 1364–1385

    @Test
    public void testReleasesOnShrink() {

        ByteBuf b1 = Unpooled.buffer(2).writeShort(1);
        ByteBuf b2 = Unpooled.buffer(2).writeShort(2);

        // composite takes ownership of s1 and s2
        ByteBuf composite = newCompositeBuffer()
            .addComponents(b1, b2);

        assertEquals(4, composite.capacity());

        // reduce capacity down to two, will drop the second component
        composite.capacity(2);
        assertEquals(2, composite.capacity());

        // releasing composite should release the components
        composite.release();
        assertEquals(0, composite.refCnt());
        assertEquals(0, b1.refCnt());
        assertEquals(0, b2.refCnt());
    }

Domain

Subdomains

Frequently Asked Questions

What does testReleasesOnShrink() do?
testReleasesOnShrink() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/AbstractCompositeByteBufTest.java.
Where is testReleasesOnShrink() defined?
testReleasesOnShrink() is defined in buffer/src/test/java/io/netty/buffer/AbstractCompositeByteBufTest.java at line 1364.

Analyze Your Own Codebase

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

Try Supermodel Free