Home / Function/ run() — netty Function Reference

run() — netty Function Reference

Architecture documentation for the run() function in IoUringIoHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  3febc8f5_f331_c39c_6774_12a24143add8["run()"]
  54b1e24c_acd2_7686_4313_2695f1b73de1["IoUringIoHandler"]
  3febc8f5_f331_c39c_6774_12a24143add8 -->|defined in| 54b1e24c_acd2_7686_4313_2695f1b73de1
  5de35c14_38b4_da68_9364_e35d6355eda9["submitEventFdRead()"]
  3febc8f5_f331_c39c_6774_12a24143add8 -->|calls| 5de35c14_38b4_da68_9364_e35d6355eda9
  d9450b94_1e0b_e88a_fddc_604693afc7b9["submitAndWaitWithTimeout()"]
  3febc8f5_f331_c39c_6774_12a24143add8 -->|calls| d9450b94_1e0b_e88a_fddc_604693afc7b9
  b5491639_cc1a_93b0_792f_d7ada8778728["submitAndClearNow()"]
  3febc8f5_f331_c39c_6774_12a24143add8 -->|calls| b5491639_cc1a_93b0_792f_d7ada8778728
  00f4b33f_14c8_6a03_69e4_20eca4fce924["processCompletionsAndHandleOverflow()"]
  3febc8f5_f331_c39c_6774_12a24143add8 -->|calls| 00f4b33f_14c8_6a03_69e4_20eca4fce924
  style 3febc8f5_f331_c39c_6774_12a24143add8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringIoHandler.java lines 157–189

    @Override
    public int run(IoHandlerContext context) {
        if (closeCompleted) {
            if (context.shouldReportActiveIoTime()) {
                context.reportActiveIoTime(0);
            }
            return 0;
        }
        SubmissionQueue submissionQueue = ringBuffer.ioUringSubmissionQueue();
        CompletionQueue completionQueue = ringBuffer.ioUringCompletionQueue();
        if (!completionQueue.hasCompletions() && context.canBlock()) {
            if (eventfdReadSubmitted == 0) {
                submitEventFdRead();
            }
            long timeoutNanos = context.deadlineNanos() == -1 ? -1 : context.delayNanos(System.nanoTime());
            submitAndWaitWithTimeout(submissionQueue, false, timeoutNanos);
        } else {
            // Even if we have some completions already pending we can still try to even fetch more.
            submitAndClearNow(submissionQueue);
        }

        int processed;
        if (context.shouldReportActiveIoTime()) {
            // Timer starts after the blocking wait, around the processing of completions.
            long activeIoStartTimeNanos = System.nanoTime();
            processed = processCompletionsAndHandleOverflow(submissionQueue, completionQueue, this::handle);
            long activeIoEndTimeNanos = System.nanoTime();
            context.reportActiveIoTime(activeIoEndTimeNanos - activeIoStartTimeNanos);
        } else {
            processed = processCompletionsAndHandleOverflow(submissionQueue, completionQueue, this::handle);
        }
        return processed;
    }

Domain

Subdomains

Frequently Asked Questions

What does run() do?
run() is a function in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringIoHandler.java.
Where is run() defined?
run() is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringIoHandler.java at line 157.
What does run() call?
run() calls 4 function(s): processCompletionsAndHandleOverflow, submitAndClearNow, submitAndWaitWithTimeout, submitEventFdRead.

Analyze Your Own Codebase

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

Try Supermodel Free