Home / Class/ AbstractIoUringServerChannel Class — netty Architecture

AbstractIoUringServerChannel Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  4efc122f_d4e7_90e6_51cb_c7fd75b903c4["AbstractIoUringServerChannel"]
  5b47452d_abef_bdce_c83f_bda00ce524e5["AbstractIoUringServerChannel.java"]
  4efc122f_d4e7_90e6_51cb_c7fd75b903c4 -->|defined in| 5b47452d_abef_bdce_c83f_bda00ce524e5
  20289d3a_0154_f5ec_19dc_c01f517935cb["AbstractIoUringServerChannel()"]
  4efc122f_d4e7_90e6_51cb_c7fd75b903c4 -->|method| 20289d3a_0154_f5ec_19dc_c01f517935cb
  67a5c21f_a644_96a1_0e47_5a71f4529630["ChannelMetadata()"]
  4efc122f_d4e7_90e6_51cb_c7fd75b903c4 -->|method| 67a5c21f_a644_96a1_0e47_5a71f4529630
  689fa5b3_cbce_d7ae_4d02_91c241f07402["doClose()"]
  4efc122f_d4e7_90e6_51cb_c7fd75b903c4 -->|method| 689fa5b3_cbce_d7ae_4d02_91c241f07402
  cb52ad32_0acd_f503_01a6_3f809f0cb776["AbstractUringUnsafe()"]
  4efc122f_d4e7_90e6_51cb_c7fd75b903c4 -->|method| cb52ad32_0acd_f503_01a6_3f809f0cb776
  91656199_d721_6f78_2165_0bc1f68ca664["doWrite()"]
  4efc122f_d4e7_90e6_51cb_c7fd75b903c4 -->|method| 91656199_d721_6f78_2165_0bc1f68ca664
  d7fa4bd2_a825_fc31_c2a3_595351bf1c16["cancelOutstandingReads()"]
  4efc122f_d4e7_90e6_51cb_c7fd75b903c4 -->|method| d7fa4bd2_a825_fc31_c2a3_595351bf1c16
  c11f5118_6ebf_44bc_d810_c273dc3f952f["cancelOutstandingWrites()"]
  4efc122f_d4e7_90e6_51cb_c7fd75b903c4 -->|method| c11f5118_6ebf_44bc_d810_c273dc3f952f
  2d61c42a_6bb8_8808_31e8_44e5501a82e6["Channel()"]
  4efc122f_d4e7_90e6_51cb_c7fd75b903c4 -->|method| 2d61c42a_6bb8_8808_31e8_44e5501a82e6
  f8ef9236_8a90_766b_a195_a878830260f0["socketIsEmpty()"]
  4efc122f_d4e7_90e6_51cb_c7fd75b903c4 -->|method| f8ef9236_8a90_766b_a195_a878830260f0
  fa96cfe0_5c90_d5c2_2a9a_56e8d90f3e5e["isPollInFirst()"]
  4efc122f_d4e7_90e6_51cb_c7fd75b903c4 -->|method| fa96cfe0_5c90_d5c2_2a9a_56e8d90f3e5e

Relationship Graph

Source Code

transport-classes-io_uring/src/main/java/io/netty/channel/uring/AbstractIoUringServerChannel.java lines 36–300

abstract class AbstractIoUringServerChannel extends AbstractIoUringChannel implements ServerChannel {
    private static final ChannelMetadata METADATA = new ChannelMetadata(false, 16);

    private static final class AcceptedAddressMemory {
        private final CleanableDirectBuffer acceptedAddressMemoryCleanable;
        private final ByteBuffer acceptedAddressMemory;
        private final CleanableDirectBuffer acceptedAddressLengthMemoryCleanable;
        private final ByteBuffer acceptedAddressLengthMemory;
        private final long acceptedAddressMemoryAddress;
        private final long acceptedAddressLengthMemoryAddress;

        AcceptedAddressMemory() {
            acceptedAddressMemoryCleanable = Buffer.allocateDirectBufferWithNativeOrder(Native.SIZEOF_SOCKADDR_STORAGE);
            acceptedAddressMemory = acceptedAddressMemoryCleanable.buffer();
            acceptedAddressMemoryAddress = Buffer.memoryAddress(acceptedAddressMemory);
            acceptedAddressLengthMemoryCleanable = Buffer.allocateDirectBufferWithNativeOrder(Long.BYTES);
            acceptedAddressLengthMemory = acceptedAddressLengthMemoryCleanable.buffer();
            // Needs to be initialized to the size of acceptedAddressMemory.
            // See https://man7.org/linux/man-pages/man2/accept.2.html
            acceptedAddressLengthMemory.putLong(0, Native.SIZEOF_SOCKADDR_STORAGE);
            acceptedAddressLengthMemoryAddress = Buffer.memoryAddress(acceptedAddressLengthMemory);
        }

        void free() {
            acceptedAddressMemoryCleanable.clean();
            acceptedAddressLengthMemoryCleanable.clean();
        }
    }
    private final AcceptedAddressMemory acceptedAddressMemory;
    private long acceptId;

    protected AbstractIoUringServerChannel(LinuxSocket socket, boolean active) {
        super(null, socket, active);

        // We can only depend on the accepted address if multi-shot is not used.
        // From the manpage:
        //       The multishot variants allow an application to issue a single
        //       accept request, which will repeatedly trigger a CQE when a
        //       connection request comes in. Like other multishot type requests,
        //       the application should look at the CQE flags and see if
        //       IORING_CQE_F_MORE is set on completion as an indication of whether
        //       or not the accept request will generate further CQEs. Note that
        //       for the multishot variants, setting addr and addrlen may not make
        //       a lot of sense, as the same value would be used for every accepted
        //       connection. This means that the data written to addr may be
        //       overwritten by a new connection before the application has had
        //       time to process a past connection. If the application knows that a
        //       new connection cannot come in before a previous one has been
        //       processed, it may be used as expected.
        if (IoUring.isAcceptMultishotEnabled()) {
            acceptedAddressMemory = null;
        } else {
            acceptedAddressMemory = new AcceptedAddressMemory();
        }
    }

    @Override
    public final ChannelMetadata metadata() {
        return METADATA;
    }

    @Override
    protected final void doClose() throws Exception {
        super.doClose();
    }

    @Override
    protected final AbstractUringUnsafe newUnsafe() {
        return new UringServerChannelUnsafe();
    }

    @Override
    protected final void doWrite(ChannelOutboundBuffer in) {
        throw new UnsupportedOperationException();
    }

    @Override
    protected final void cancelOutstandingReads(IoRegistration registration, int numOutstandingReads) {
        if (acceptId != 0) {
            assert numOutstandingReads == 1 || numOutstandingReads == -1;
            IoUringIoOps ops = IoUringIoOps.newAsyncCancel((byte) 0, acceptId, Native.IORING_OP_ACCEPT);

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free