Home / Function/ destroy() — netty Function Reference

destroy() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  093f8eee_4384_b7ac_3228_6a911c17e627["destroy()"]
  54b1e24c_acd2_7686_4313_2695f1b73de1["IoUringIoHandler"]
  093f8eee_4384_b7ac_3228_6a911c17e627 -->|defined in| 54b1e24c_acd2_7686_4313_2695f1b73de1
  ba804e78_369a_b616_6db6_06516ef2b298["drainEventFd()"]
  093f8eee_4384_b7ac_3228_6a911c17e627 -->|calls| ba804e78_369a_b616_6db6_06516ef2b298
  513438f0_b49b_4a1e_b61f_b88845bcbbfb["submit()"]
  093f8eee_4384_b7ac_3228_6a911c17e627 -->|calls| 513438f0_b49b_4a1e_b61f_b88845bcbbfb
  d9450b94_1e0b_e88a_fddc_604693afc7b9["submitAndWaitWithTimeout()"]
  093f8eee_4384_b7ac_3228_6a911c17e627 -->|calls| d9450b94_1e0b_e88a_fddc_604693afc7b9
  8f2a381b_f18c_57d0_86ff_b77731543e9e["close()"]
  093f8eee_4384_b7ac_3228_6a911c17e627 -->|calls| 8f2a381b_f18c_57d0_86ff_b77731543e9e
  bac4ae32_245b_a776_8ab7_2265cd144fdb["completeRingClose()"]
  093f8eee_4384_b7ac_3228_6a911c17e627 -->|calls| bac4ae32_245b_a776_8ab7_2265cd144fdb
  style 093f8eee_4384_b7ac_3228_6a911c17e627 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

    @Override
    public void destroy() {
        SubmissionQueue submissionQueue = ringBuffer.ioUringSubmissionQueue();
        CompletionQueue completionQueue = ringBuffer.ioUringCompletionQueue();
        drainEventFd();
        if (submissionQueue.remaining() < 2) {
            // We need to submit 2 linked operations. Since they are linked, we cannot allow a submit-call to
            // separate them. We don't have enough room (< 2) in the queue, so we submit now to make more room.
            submissionQueue.submit();
        }
        // Try to drain all the IO from the queue first...
        long udata = UserData.encode(RINGFD_ID, Native.IORING_OP_NOP, (short) 0);
        // We need to also specify the Native.IOSQE_LINK flag for it to work as otherwise it is not correctly linked
        // with the timeout.
        // See:
        // - https://man7.org/linux/man-pages/man2/io_uring_enter.2.html
        // - https://git.kernel.dk/cgit/liburing/commit/?h=link-timeout&id=bc1bd5e97e2c758d6fd975bd35843b9b2c770c5a
        submissionQueue.addNop((byte) (Native.IOSQE_IO_DRAIN | Native.IOSQE_LINK), udata);
        // ... but only wait for 200 milliseconds on this
        submitAndWaitWithTimeout(submissionQueue, true, TimeUnit.MILLISECONDS.toNanos(200));
        completionQueue.process(this::handle);
        for (IoUringBufferRing ioUringBufferRing : registeredIoUringBufferRing.values()) {
            ioUringBufferRing.close();
        }
        completeRingClose();
    }

Domain

Subdomains

Frequently Asked Questions

What does destroy() do?
destroy() is a function in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringIoHandler.java.
Where is destroy() defined?
destroy() is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringIoHandler.java at line 374.
What does destroy() call?
destroy() calls 5 function(s): close, completeRingClose, drainEventFd, submit, submitAndWaitWithTimeout.

Analyze Your Own Codebase

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

Try Supermodel Free