Home / Class/ SubmissionQueue Class — netty Architecture

SubmissionQueue Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a["SubmissionQueue"]
  4a47ba6a_fa26_4db6_9be6_9f8c684c1cde["SubmissionQueue.java"]
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a -->|defined in| 4a47ba6a_fa26_4db6_9be6_9f8c684c1cde
  2d633ef4_f8d6_73f9_3339_c7b325a52094["SubmissionQueue()"]
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a -->|method| 2d633ef4_f8d6_73f9_3339_c7b325a52094
  05f6a919_4b57_5e77_5d60_7f93395ef3fb["flags()"]
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a -->|method| 05f6a919_4b57_5e77_5d60_7f93395ef3fb
  c94c464c_ae46_bdc8_cbce_9c699a240fc3["submissionQueueArrayAddress()"]
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a -->|method| c94c464c_ae46_bdc8_cbce_9c699a240fc3
  6e7f642b_244d_51e7_bb4f_eaa15df03e8f["close()"]
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a -->|method| 6e7f642b_244d_51e7_bb4f_eaa15df03e8f
  8a51d74d_fd76_09f6_f454_5a079f4faf11["checkClosed()"]
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a -->|method| 8a51d74d_fd76_09f6_f454_5a079f4faf11
  960730d2_3253_4848_e62d_c72351b93285["tryRegisterRingFd()"]
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a -->|method| 960730d2_3253_4848_e62d_c72351b93285
  c9f3c0e1_0223_d8cb_573c_0a6b4f825ed0["enqueueSqe()"]
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a -->|method| c9f3c0e1_0223_d8cb_573c_0a6b4f825ed0
  a203f7d6_2869_dfbd_6dac_3e272beccace["String()"]
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a -->|method| a203f7d6_2869_dfbd_6dac_3e272beccace
  a22a12c8_9766_9c14_7ec7_ae33971f0404["sqeIndex()"]
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a -->|method| a22a12c8_9766_9c14_7ec7_ae33971f0404
  26367a12_3ac1_e713_ab97_2b365bd944b4["addNop()"]
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a -->|method| 26367a12_3ac1_e713_ab97_2b365bd944b4
  bff6157b_1db2_edb9_7d14_27e3e3c7170e["addTimeout()"]
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a -->|method| bff6157b_1db2_edb9_7d14_27e3e3c7170e
  dfaab29f_05f1_7a3a_45ed_9a79fde3cf68["addLinkTimeout()"]
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a -->|method| dfaab29f_05f1_7a3a_45ed_9a79fde3cf68
  eb97bc21_6427_82df_7e85_c6277a87c8fe["addEventFdRead()"]
  1d316f16_48b4_d00e_edf3_3c8fd55f9a6a -->|method| eb97bc21_6427_82df_7e85_c6277a87c8fe

Relationship Graph

Source Code

transport-classes-io_uring/src/main/java/io/netty/channel/uring/SubmissionQueue.java lines 30–326

final class SubmissionQueue {
    private static final InternalLogger logger = InternalLoggerFactory.getInstance(SubmissionQueue.class);

    static final int SQE_SIZE = 64;

    //these offsets are used to access specific properties
    //SQE https://github.com/axboe/liburing/blob/liburing-2.6/src/include/liburing/io_uring.h#L30
    private static final int SQE_OP_CODE_FIELD = 0;
    private static final int SQE_FLAGS_FIELD = 1;
    private static final int SQE_IOPRIO_FIELD = 2; // u16
    private static final int SQE_FD_FIELD = 4; // s32
    private static final int SQE_UNION1_FIELD = 8;
    private static final int SQE_UNION2_FIELD = 16;
    private static final int SQE_LEN_FIELD = 24;
    private static final int SQE_UNION3_FIELD = 28;
    private static final int SQE_USER_DATA_FIELD = 32;
    private static final int SQE_UNION4_FIELD = 40;
    private static final int SQE_PERSONALITY_FIELD = 42;
    private static final int SQE_UNION5_FIELD = 44;
    private static final int SQE_UNION6_FIELD = 48;

    // These unsigned integer pointers(shared with the kernel) will be changed by the kernel and us
    // using a VarHandle.
    private static final VarHandle INT_HANDLE =
            MethodHandles.byteBufferViewVarHandle(int[].class, ByteOrder.nativeOrder());
    private final ByteBuffer kHead;
    private final ByteBuffer kTail;
    private final ByteBuffer kflags;
    private final ByteBuffer submissionQueueArray;

    final int ringEntries;
    private final int ringMask; // = ringEntries - 1

    final int ringSize;
    final long ringAddress;
    final int ringFd;
    int enterRingFd;
    private int enterFlags;
    private int head;
    private int tail;

    private boolean closed;

    SubmissionQueue(ByteBuffer khead, ByteBuffer ktail, int ringMask, int ringEntries, ByteBuffer kflags,
                    ByteBuffer submissionQueueArray,
                    int ringSize, long ringAddress,
                    int ringFd) {
        this.kHead = khead;
        this.kTail = ktail;
        this.submissionQueueArray = submissionQueueArray;
        this.ringSize = ringSize;
        this.ringAddress = ringAddress;
        this.ringFd = ringFd;
        this.enterRingFd = ringFd;
        this.ringEntries = ringEntries;
        this.kflags = kflags;
        this.ringMask = ringMask;
        this.head = (int) INT_HANDLE.getVolatile(khead, 0);
        this.tail = (int) INT_HANDLE.getVolatile(ktail, 0);
    }

    int flags() {
        if (closed) {
            return 0;
        }
        // we only need memory_order_relaxed
        return (int) INT_HANDLE.getOpaque(kflags, 0);
    }

    long submissionQueueArrayAddress() {
        return Buffer.memoryAddress(submissionQueueArray);
    }

    void close() {
        closed = true;
    }

    private void checkClosed() {
        if (closed) {
            throw new IllegalStateException();
        }

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free