Home / Function/ testReadGatheringByteChannelMultipleThreads() — netty Function Reference

testReadGatheringByteChannelMultipleThreads() — netty Function Reference

Architecture documentation for the testReadGatheringByteChannelMultipleThreads() function in AbstractByteBufTest.java from the netty codebase.

Function java Buffer Allocators calls 2 called by 2

Entity Profile

Dependency Diagram

graph TD
  3df03248_fc67_1563_4b08_c13178b6a5bc["testReadGatheringByteChannelMultipleThreads()"]
  6540f2d1_cdad_6705_dd1d_9a24e2e53242["AbstractByteBufTest"]
  3df03248_fc67_1563_4b08_c13178b6a5bc -->|defined in| 6540f2d1_cdad_6705_dd1d_9a24e2e53242
  dd988c2f_724e_238e_9a57_0d5e65a9d84e["testDuplicateReadGatheringByteChannelMultipleThreads()"]
  dd988c2f_724e_238e_9a57_0d5e65a9d84e -->|calls| 3df03248_fc67_1563_4b08_c13178b6a5bc
  64829690_44f2_cd69_b214_b92b9bbd6a41["testSliceReadGatheringByteChannelMultipleThreads()"]
  64829690_44f2_cd69_b214_b92b9bbd6a41 -->|calls| 3df03248_fc67_1563_4b08_c13178b6a5bc
  59ba4968_9c0d_bad7_eec5_7f3db0ff59a4["TestGatheringByteChannel()"]
  3df03248_fc67_1563_4b08_c13178b6a5bc -->|calls| 59ba4968_9c0d_bad7_eec5_7f3db0ff59a4
  db8583f4_ff68_4133_f18f_f472723e565e["writtenBytes()"]
  3df03248_fc67_1563_4b08_c13178b6a5bc -->|calls| db8583f4_ff68_4133_f18f_f472723e565e
  style 3df03248_fc67_1563_4b08_c13178b6a5bc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java lines 2745–2784

    static void testReadGatheringByteChannelMultipleThreads(
            final ByteBuf buffer, final byte[] expectedBytes, final boolean slice) throws Exception {
        assertEquals(buffer.readableBytes(), expectedBytes.length);
        final CountDownLatch latch = new CountDownLatch(60000);
        final CyclicBarrier barrier = new CyclicBarrier(11);
        for (int i = 0; i < 10; i++) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    while (latch.getCount() > 0) {
                        ByteBuf buf;
                        if (slice) {
                           buf = buffer.slice();
                        } else {
                           buf = buffer.duplicate();
                        }
                        TestGatheringByteChannel channel = new TestGatheringByteChannel();

                        while (buf.isReadable()) {
                            try {
                                buf.readBytes(channel, buf.readableBytes());
                            } catch (IOException e) {
                                // Never happens
                                return;
                            }
                        }
                        assertArrayEquals(expectedBytes, channel.writtenBytes());
                        latch.countDown();
                    }
                    try {
                        barrier.await();
                    } catch (Exception e) {
                        // ignore
                    }
                }
            }).start();
        }
        latch.await(10, TimeUnit.SECONDS);
        barrier.await(5, TimeUnit.SECONDS);
    }

Domain

Subdomains

Frequently Asked Questions

What does testReadGatheringByteChannelMultipleThreads() do?
testReadGatheringByteChannelMultipleThreads() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java.
Where is testReadGatheringByteChannelMultipleThreads() defined?
testReadGatheringByteChannelMultipleThreads() is defined in buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java at line 2745.
What does testReadGatheringByteChannelMultipleThreads() call?
testReadGatheringByteChannelMultipleThreads() calls 2 function(s): TestGatheringByteChannel, writtenBytes.
What calls testReadGatheringByteChannelMultipleThreads()?
testReadGatheringByteChannelMultipleThreads() is called by 2 function(s): testDuplicateReadGatheringByteChannelMultipleThreads, testSliceReadGatheringByteChannelMultipleThreads.

Analyze Your Own Codebase

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

Try Supermodel Free