testAllocateWithoutLock() — netty Function Reference
Architecture documentation for the testAllocateWithoutLock() function in AdaptiveByteBufAllocatorTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD a9a9e47f_2501_5fdc_9861_3d014f4150af["testAllocateWithoutLock()"] b5780ec9_74a4_594b_4225_0099765d71e7["AdaptiveByteBufAllocatorTest"] a9a9e47f_2501_5fdc_9861_3d014f4150af -->|defined in| b5780ec9_74a4_594b_4225_0099765d71e7 f95f6269_707a_cb2d_e5c5_1293cb0ec01f["AdaptiveByteBufAllocator()"] a9a9e47f_2501_5fdc_9861_3d014f4150af -->|calls| f95f6269_707a_cb2d_e5c5_1293cb0ec01f style a9a9e47f_2501_5fdc_9861_3d014f4150af fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
buffer/src/test/java/io/netty/buffer/AdaptiveByteBufAllocatorTest.java lines 189–224
@Test
public void testAllocateWithoutLock() throws InterruptedException {
final AdaptiveByteBufAllocator alloc = new AdaptiveByteBufAllocator();
// Make `threadCount` bigger than `AdaptivePoolingAllocator.MAX_STRIPES`, to let thread collision easily happen.
int threadCount = NettyRuntime.availableProcessors() * 4;
final CountDownLatch countDownLatch = new CountDownLatch(threadCount);
final AtomicReference<Throwable> throwableAtomicReference = new AtomicReference<Throwable>();
for (int i = 0; i < threadCount; i++) {
new Thread(new Runnable() {
@Override
public void run() {
for (int j = 0; j < 1024; j++) {
try {
ByteBuf buffer = null;
try {
buffer = alloc.heapBuffer(128);
buffer.ensureWritable(ThreadLocalRandom.current().nextInt(512, 32769));
} finally {
if (buffer != null) {
buffer.release();
}
}
} catch (Throwable t) {
throwableAtomicReference.set(t);
}
}
countDownLatch.countDown();
}
}).start();
}
countDownLatch.await();
Throwable throwable = throwableAtomicReference.get();
if (throwable != null) {
fail("Expected no exception, but got", throwable);
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testAllocateWithoutLock() do?
testAllocateWithoutLock() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/AdaptiveByteBufAllocatorTest.java.
Where is testAllocateWithoutLock() defined?
testAllocateWithoutLock() is defined in buffer/src/test/java/io/netty/buffer/AdaptiveByteBufAllocatorTest.java at line 189.
What does testAllocateWithoutLock() call?
testAllocateWithoutLock() calls 1 function(s): AdaptiveByteBufAllocator.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free