testMultipleRetainedSliceReleaseOriginal() — netty Function Reference
Architecture documentation for the testMultipleRetainedSliceReleaseOriginal() function in AbstractByteBufTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD a58efef4_c925_9e72_7660_4cec76add040["testMultipleRetainedSliceReleaseOriginal()"] 6540f2d1_cdad_6705_dd1d_9a24e2e53242["AbstractByteBufTest"] a58efef4_c925_9e72_7660_4cec76add040 -->|defined in| 6540f2d1_cdad_6705_dd1d_9a24e2e53242 61bd81e1_3e1b_0cb3_313c_290e36ad2cb7["testMultipleRetainedSliceReleaseOriginal1()"] 61bd81e1_3e1b_0cb3_313c_290e36ad2cb7 -->|calls| a58efef4_c925_9e72_7660_4cec76add040 13b1bb5d_d68b_dd3d_7251_e8711223e4be["testMultipleRetainedSliceReleaseOriginal2()"] 13b1bb5d_d68b_dd3d_7251_e8711223e4be -->|calls| a58efef4_c925_9e72_7660_4cec76add040 f5cd126d_3f83_bf1f_a7d2_2bd0c6d6da25["testMultipleRetainedSliceReleaseOriginal3()"] f5cd126d_3f83_bf1f_a7d2_2bd0c6d6da25 -->|calls| a58efef4_c925_9e72_7660_4cec76add040 8c5fba72_c632_ee77_cc76_fb8e48d0b7ff["testMultipleRetainedSliceReleaseOriginal4()"] 8c5fba72_c632_ee77_cc76_fb8e48d0b7ff -->|calls| a58efef4_c925_9e72_7660_4cec76add040 style a58efef4_c925_9e72_7660_4cec76add040 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java lines 5633–5675
private void testMultipleRetainedSliceReleaseOriginal(boolean retainedSlice1, boolean retainedSlice2) {
ByteBuf buf = newBuffer(8).resetWriterIndex();
ByteBuf expected1 = newBuffer(3).resetWriterIndex();
ByteBuf expected2 = newBuffer(2).resetWriterIndex();
ByteBuf expected3 = newBuffer(2).resetWriterIndex();
buf.writeBytes(new byte[] {1, 2, 3, 4, 5, 6, 7, 8});
expected1.writeBytes(new byte[] {6, 7, 8});
expected2.writeBytes(new byte[] {7, 8});
expected3.writeBytes(new byte[] {6, 7});
ByteBuf slice1 = retainedSlice1 ? buf.retainedSlice(buf.readerIndex() + 5, 3)
: buf.slice(buf.readerIndex() + 5, 3).retain();
assertEquals(0, slice1.compareTo(expected1));
// Simulate a handler that releases the original buffer, and propagates a slice.
buf.release();
ByteBuf slice2 = retainedSlice2 ? slice1.retainedSlice(slice1.readerIndex() + 1, 2)
: slice1.slice(slice1.readerIndex() + 1, 2).retain();
assertEquals(0, slice2.compareTo(expected2));
// The handler created a slice of the slice and is now done with it.
slice2.release();
ByteBuf slice3 = slice1.retainedSlice(slice1.readerIndex(), 2);
assertEquals(0, slice3.compareTo(expected3));
// The handler created another slice of the slice and is now done with it.
slice3.release();
// The handler is now done with the original slice
assertTrue(slice1.release());
// Cleanup the expected buffers used for testing.
assertTrue(expected1.release());
assertTrue(expected2.release());
assertTrue(expected3.release());
// Reference counting may be shared, or may be independently tracked, but at this point all buffers should
// be deallocated and have a reference count of 0.
assertEquals(0, buf.refCnt());
assertEquals(0, slice1.refCnt());
assertEquals(0, slice2.refCnt());
assertEquals(0, slice3.refCnt());
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does testMultipleRetainedSliceReleaseOriginal() do?
testMultipleRetainedSliceReleaseOriginal() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java.
Where is testMultipleRetainedSliceReleaseOriginal() defined?
testMultipleRetainedSliceReleaseOriginal() is defined in buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java at line 5633.
What calls testMultipleRetainedSliceReleaseOriginal()?
testMultipleRetainedSliceReleaseOriginal() is called by 4 function(s): testMultipleRetainedSliceReleaseOriginal1, testMultipleRetainedSliceReleaseOriginal2, testMultipleRetainedSliceReleaseOriginal3, testMultipleRetainedSliceReleaseOriginal4.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free