testReleasesItsComponents2() — netty Function Reference
Architecture documentation for the testReleasesItsComponents2() function in AbstractCompositeByteBufTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 74935586_ce53_cf93_1c17_bba7e05680e5["testReleasesItsComponents2()"] 47bc0a20_e243_89ff_132b_99ac6b23835f["AbstractCompositeByteBufTest"] 74935586_ce53_cf93_1c17_bba7e05680e5 -->|defined in| 47bc0a20_e243_89ff_132b_99ac6b23835f style 74935586_ce53_cf93_1c17_bba7e05680e5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
buffer/src/test/java/io/netty/buffer/AbstractCompositeByteBufTest.java lines 1330–1362
@Test
public void testReleasesItsComponents2() {
// It is important to use a pooled allocator here to ensure
// the slices returned by readRetainedSlice are of type
// PooledSlicedByteBuf, which maintains an independent refcount
// (so that we can be sure to cover this case)
ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); // 1
buffer.writeBytes(new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
// use readRetainedSlice this time - produces different kind of slices
ByteBuf s1 = buffer.readRetainedSlice(2); // 2
ByteBuf s2 = s1.readRetainedSlice(2); // 3
ByteBuf s3 = s2.readRetainedSlice(2); // 4
ByteBuf s4 = s3.readRetainedSlice(2); // 5
ByteBuf composite = newCompositeBuffer()
.addComponent(s1)
.addComponents(s2, s3, s4)
.order(ByteOrder.LITTLE_ENDIAN);
assertEquals(1, composite.refCnt());
assertEquals(2, buffer.refCnt());
// releasing composite should release the 4 components
composite.release();
assertEquals(0, composite.refCnt());
assertEquals(1, buffer.refCnt());
// last remaining ref to buffer
buffer.release();
assertEquals(0, buffer.refCnt());
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testReleasesItsComponents2() do?
testReleasesItsComponents2() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/AbstractCompositeByteBufTest.java.
Where is testReleasesItsComponents2() defined?
testReleasesItsComponents2() is defined in buffer/src/test/java/io/netty/buffer/AbstractCompositeByteBufTest.java at line 1330.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free