Home / Class/ IoUringDatagramChannel Class — netty Architecture

IoUringDatagramChannel Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  15b83cff_6ad6_b58a_64e5_7942764a0d6c["IoUringDatagramChannel"]
  84d8ef59_34c3_a366_2f8b_b5fcde9ce2c0["IoUringDatagramChannel.java"]
  15b83cff_6ad6_b58a_64e5_7942764a0d6c -->|defined in| 84d8ef59_34c3_a366_2f8b_b5fcde9ce2c0
  0e8241b0_1384_5c52_ada1_60dfcdcb0e94["IoUringDatagramChannel()"]
  15b83cff_6ad6_b58a_64e5_7942764a0d6c -->|method| 0e8241b0_1384_5c52_ada1_60dfcdcb0e94
  125dd165_594c_8e15_f660_0107c4eba69d["useIpv6()"]
  15b83cff_6ad6_b58a_64e5_7942764a0d6c -->|method| 125dd165_594c_8e15_f660_0107c4eba69d
  5139df4f_43e6_5eae_c4d6_d369db22201d["InetSocketAddress()"]
  15b83cff_6ad6_b58a_64e5_7942764a0d6c -->|method| 5139df4f_43e6_5eae_c4d6_d369db22201d
  d8f92171_a38d_f901_f54c_00e195b79826["ChannelMetadata()"]
  15b83cff_6ad6_b58a_64e5_7942764a0d6c -->|method| d8f92171_a38d_f901_f54c_00e195b79826
  aec55b6e_5679_6ded_75c2_48241a188d95["isActive()"]
  15b83cff_6ad6_b58a_64e5_7942764a0d6c -->|method| aec55b6e_5679_6ded_75c2_48241a188d95
  d828b83f_94a8_2a98_84e1_808c4585cd2a["isConnected()"]
  15b83cff_6ad6_b58a_64e5_7942764a0d6c -->|method| d828b83f_94a8_2a98_84e1_808c4585cd2a
  e3b46e00_1e02_9bd4_2356_6ae3b5507ce3["ChannelFuture()"]
  15b83cff_6ad6_b58a_64e5_7942764a0d6c -->|method| e3b46e00_1e02_9bd4_2356_6ae3b5507ce3
  c9b0e1c3_880e_c950_b53b_40050bda7961["AbstractUnsafe()"]
  15b83cff_6ad6_b58a_64e5_7942764a0d6c -->|method| c9b0e1c3_880e_c950_b53b_40050bda7961
  ef7026fa_f124_c323_2add_fa7765627a28["doBind()"]
  15b83cff_6ad6_b58a_64e5_7942764a0d6c -->|method| ef7026fa_f124_c323_2add_fa7765627a28
  ee90403c_c72a_8c20_2098_0e7523cfd5b3["checkUnresolved()"]
  15b83cff_6ad6_b58a_64e5_7942764a0d6c -->|method| ee90403c_c72a_8c20_2098_0e7523cfd5b3
  77636a97_89f5_006d_0546_243b77ddef75["Object()"]
  15b83cff_6ad6_b58a_64e5_7942764a0d6c -->|method| 77636a97_89f5_006d_0546_243b77ddef75
  c57d44bf_13dd_8551_4a03_a8b0a95af1f5["DatagramChannelConfig()"]
  15b83cff_6ad6_b58a_64e5_7942764a0d6c -->|method| c57d44bf_13dd_8551_4a03_a8b0a95af1f5
  e99b084a_f6ce_d42e_c2bb_abd6bd1bf11d["doDisconnect()"]
  15b83cff_6ad6_b58a_64e5_7942764a0d6c -->|method| e99b084a_f6ce_d42e_c2bb_abd6bd1bf11d

Relationship Graph

Source Code

transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringDatagramChannel.java lines 54–711

public final class IoUringDatagramChannel extends AbstractIoUringChannel implements DatagramChannel {
    private static final InternalLogger logger = InternalLoggerFactory.getInstance(IoUringDatagramChannel.class);
    private static final boolean IP_MULTICAST_ALL =
            SystemPropertyUtil.getBoolean("io.netty.channel.iouring.ipMulticastAll", false);
    private static final ChannelMetadata METADATA = new ChannelMetadata(true, 16);
    private static final String EXPECTED_TYPES =
            " (expected: " + StringUtil.simpleClassName(DatagramPacket.class) + ", " +
            StringUtil.simpleClassName(AddressedEnvelope.class) + '<' +
            StringUtil.simpleClassName(ByteBuf.class) + ", " +
            StringUtil.simpleClassName(InetSocketAddress.class) + ">, " +
            StringUtil.simpleClassName(ByteBuf.class) + ')';

    private final IoUringDatagramChannelConfig config;
    private volatile boolean connected;

    static {
        if (logger.isDebugEnabled()) {
            logger.debug("-Dio.netty.channel.iouring.ipMulticastAll: {}", IP_MULTICAST_ALL);
        }
    }

    // These buffers are used for msghdr, iov, sockaddr_in / sockaddr_in6 when doing recvmsg / sendmsg
    //
    // TODO: Alternative we could also allocate these everytime from the ByteBufAllocator or we could use
    //       some sort of other pool. Let's keep it simple for now.
    //
    // Consider exposing some configuration for that.
    private final MsgHdrMemoryArray recvmsgHdrs = new MsgHdrMemoryArray((short) 256);
    private final MsgHdrMemoryArray sendmsgHdrs = new MsgHdrMemoryArray((short) 256);
    private final int[] sendmsgResArray = new int[sendmsgHdrs.capacity()];

    /**
     * Create a new instance which selects the {@link SocketProtocolFamily} to use depending
     * on the Operation Systems default which will be chosen.
     */
    public IoUringDatagramChannel() {
        this(null);
    }

    /**
     * Create a new instance using the given {@link SocketProtocolFamily}. If {@code null} is used it will depend
     * on the Operation Systems default which will be chosen.
     */
    public IoUringDatagramChannel(SocketProtocolFamily family) {
        this(LinuxSocket.newSocketDgram(useIpv6(family)), false);
    }

    private static boolean useIpv6(SocketProtocolFamily family) {
        if (family == null) {
            return Socket.isIPv6Preferred();
        }
        return family == SocketProtocolFamily.INET6;
    }

    /**
     * Create a new instance which selects the {@link SocketProtocolFamily} to use depending
     * on the Operation Systems default which will be chosen.
     */
    public IoUringDatagramChannel(int fd) {
        this(new LinuxSocket(fd), true);
    }

    private IoUringDatagramChannel(LinuxSocket fd, boolean active) {
        // Always use a blocking fd and so make use of fast-poll.
        super(null, fd, active);

        // Configure IP_MULTICAST_ALL - disable by default to match the behaviour of NIO.
        try {
            fd.setIpMulticastAll(IP_MULTICAST_ALL);
        } catch (IOException | ChannelException e) {
            logger.debug("Failed to set IP_MULTICAST_ALL to {}", IP_MULTICAST_ALL, e);
        }

        config = new IoUringDatagramChannelConfig(this);
    }

    @Override
    public InetSocketAddress remoteAddress() {
        return (InetSocketAddress) super.remoteAddress();
    }

Frequently Asked Questions

What is the IoUringDatagramChannel class?
IoUringDatagramChannel is a class in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringDatagramChannel.java.
Where is IoUringDatagramChannel defined?
IoUringDatagramChannel is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringDatagramChannel.java at line 54.

Analyze Your Own Codebase

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

Try Supermodel Free