Home / Function/ shouldCreateTwoChunks() — netty Function Reference

shouldCreateTwoChunks() — netty Function Reference

Architecture documentation for the shouldCreateTwoChunks() function in AdaptiveByteBufAllocatorTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  026a186e_7bf8_082c_39cf_6bffbbc8bec2["shouldCreateTwoChunks()"]
  b5780ec9_74a4_594b_4225_0099765d71e7["AdaptiveByteBufAllocatorTest"]
  026a186e_7bf8_082c_39cf_6bffbbc8bec2 -->|defined in| b5780ec9_74a4_594b_4225_0099765d71e7
  style 026a186e_7bf8_082c_39cf_6bffbbc8bec2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/AdaptiveByteBufAllocatorTest.java lines 249–278

    @SuppressWarnings("Since15")
    @Test
    @EnabledForJreRange(min = JRE.JAVA_17) // RecordingStream
    @Timeout(10)
    public void shouldCreateTwoChunks() throws Exception {
        try (RecordingStream stream = new RecordingStream()) {
            final CountDownLatch eventsFlushed = new CountDownLatch(2);
            stream.enable(AllocateChunkEvent.class);
            stream.onEvent(AllocateChunkEvent.NAME,
                           event -> {
                                eventsFlushed.countDown();
                           });
            stream.startAsync();
            ByteBufAllocator allocator = newAllocator(false);
            int bufSize = 16896;
            int minSegmentsPerChunk = 32; // See AdaptivePoolingAllocator.SizeClassChunkController.
            int bufsToAllocate = 1 + minSegmentsPerChunk;
            List<ByteBuf> buffers = new ArrayList<>(bufsToAllocate);
            for (int i = 0; i < bufsToAllocate; ++i) {
                buffers.add(allocator.heapBuffer(bufSize, bufSize));
            }
            // release all buffers
            for (ByteBuf buffer : buffers) {
                buffer.release();
            }
            buffers.clear();
            eventsFlushed.await();
            assertEquals(0, eventsFlushed.getCount());
        }
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free