Home / Class/ IoUringDatagramUnicastTest Class — netty Architecture

IoUringDatagramUnicastTest Class — netty Architecture

Architecture documentation for the IoUringDatagramUnicastTest class in IoUringDatagramUnicastTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  c96f9f52_a5fb_f24b_d706_f98a21c8d733["IoUringDatagramUnicastTest"]
  2bfb12ef_e93d_ad7f_2925_7b52a73ea53b["IoUringDatagramUnicastTest.java"]
  c96f9f52_a5fb_f24b_d706_f98a21c8d733 -->|defined in| 2bfb12ef_e93d_ad7f_2925_7b52a73ea53b
  543a623c_12d8_56e5_6845_4ff040f4dbfc["loadJNI()"]
  c96f9f52_a5fb_f24b_d706_f98a21c8d733 -->|method| 543a623c_12d8_56e5_6845_4ff040f4dbfc
  cf6c0dc7_099f_e819_4fc7_9c18eac3fffb["newFactories()"]
  c96f9f52_a5fb_f24b_d706_f98a21c8d733 -->|method| cf6c0dc7_099f_e819_4fc7_9c18eac3fffb
  868a4f3a_f467_db60_f4c4_206b57381199["testRecvMsgDontBlock()"]
  c96f9f52_a5fb_f24b_d706_f98a21c8d733 -->|method| 868a4f3a_f467_db60_f4c4_206b57381199
  658c21a9_a761_2a3f_3cb2_d2a2ae52c6c0["supportDisconnect()"]
  c96f9f52_a5fb_f24b_d706_f98a21c8d733 -->|method| 658c21a9_a761_2a3f_3cb2_d2a2ae52c6c0

Relationship Graph

Source Code

transport-native-io_uring/src/test/java/io/netty/channel/uring/IoUringDatagramUnicastTest.java lines 41–106

public class IoUringDatagramUnicastTest extends DatagramUnicastInetTest {

    @BeforeAll
    public static void loadJNI() {
        assumeTrue(IoUring.isAvailable());
    }

    @Override
    protected List<TestsuitePermutation.BootstrapComboFactory<Bootstrap, Bootstrap>> newFactories() {
        return IoUringSocketTestPermutation.INSTANCE.datagram(SocketProtocolFamily.INET);
    }

    @Test
    @Timeout(8)
    public void testRecvMsgDontBlock(TestInfo testInfo) throws Throwable {
        run(testInfo, this::testRecvMsgDontBlock);
    }

    public void testRecvMsgDontBlock(Bootstrap sb, Bootstrap cb) throws Throwable {
        Channel sc = null;
        Channel cc = null;

        try {
            cb.handler(new SimpleChannelInboundHandler<Object>() {
                @Override
                protected void channelRead0(ChannelHandlerContext ctx, Object msg) {
                    // NOOP.
                }
            });
            cc = cb.bind(newSocketAddress()).sync().channel();

            CountDownLatch readLatch = new CountDownLatch(1);
            CountDownLatch readCompleteLatch = new CountDownLatch(1);
            sc = sb.handler(new ChannelInboundHandlerAdapter() {
                @Override
                public void channelRead(ChannelHandlerContext ctx, Object msg) {
                    readLatch.countDown();
                    ReferenceCountUtil.release(msg);
                }

                @Override
                public void channelReadComplete(ChannelHandlerContext ctx) {
                    readCompleteLatch.countDown();
                }
            }).option(ChannelOption.RECVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(2048))
                    .bind(newSocketAddress()).sync().channel();
            InetSocketAddress addr = sendToAddress((InetSocketAddress) sc.localAddress());
            cc.writeAndFlush(new DatagramPacket(cc.alloc().buffer().writeZero(512),  addr)).sync();

            readLatch.await();
            readCompleteLatch.await();
        } finally {
            if (cc != null) {
                cc.close().sync();
            }
            if (sc != null) {
                sc.close().sync();
            }
        }
    }

    @Override
    protected boolean supportDisconnect() {
        return false;
    }
}

Frequently Asked Questions

What is the IoUringDatagramUnicastTest class?
IoUringDatagramUnicastTest is a class in the netty codebase, defined in transport-native-io_uring/src/test/java/io/netty/channel/uring/IoUringDatagramUnicastTest.java.
Where is IoUringDatagramUnicastTest defined?
IoUringDatagramUnicastTest is defined in transport-native-io_uring/src/test/java/io/netty/channel/uring/IoUringDatagramUnicastTest.java at line 41.

Analyze Your Own Codebase

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

Try Supermodel Free