Home / Function/ prepareToDestroy() — netty Function Reference

prepareToDestroy() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  88492ff3_9115_7f63_0291_32ae2900e2a2["prepareToDestroy()"]
  54b1e24c_acd2_7686_4313_2695f1b73de1["IoUringIoHandler"]
  88492ff3_9115_7f63_0291_32ae2900e2a2 -->|defined in| 54b1e24c_acd2_7686_4313_2695f1b73de1
  8f2a381b_f18c_57d0_86ff_b77731543e9e["close()"]
  88492ff3_9115_7f63_0291_32ae2900e2a2 -->|calls| 8f2a381b_f18c_57d0_86ff_b77731543e9e
  00f4b33f_14c8_6a03_69e4_20eca4fce924["processCompletionsAndHandleOverflow()"]
  88492ff3_9115_7f63_0291_32ae2900e2a2 -->|calls| 00f4b33f_14c8_6a03_69e4_20eca4fce924
  style 88492ff3_9115_7f63_0291_32ae2900e2a2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

    @Override
    public void prepareToDestroy() {
        shuttingDown = true;
        CompletionQueue completionQueue = ringBuffer.ioUringCompletionQueue();
        SubmissionQueue submissionQueue = ringBuffer.ioUringSubmissionQueue();

        List<DefaultIoUringIoRegistration> copy = new ArrayList<>(registrations.values());

        for (DefaultIoUringIoRegistration registration: copy) {
            registration.close();
        }

        // Write to the eventfd to ensure that if we submitted a read for the eventfd we will see the completion event.
        Native.eventFdWrite(eventfd.intValue(), 1L);

        // Ensure all previously submitted IOs get to complete before tearing down everything.
        long udata = UserData.encode(RINGFD_ID, Native.IORING_OP_NOP, (short) 0);
        submissionQueue.addNop((byte) Native.IOSQE_IO_DRAIN, udata);

        // Submit everything and wait until we could drain i.
        submissionQueue.submitAndGet();

        while (completionQueue.hasCompletions()) {
            processCompletionsAndHandleOverflow(submissionQueue, completionQueue, this::handle);
            if (submissionQueue.count() > 0) {
                submissionQueue.submitAndGetNow();
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does prepareToDestroy() do?
prepareToDestroy() is a function in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringIoHandler.java.
Where is prepareToDestroy() defined?
prepareToDestroy() is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringIoHandler.java at line 344.
What does prepareToDestroy() call?
prepareToDestroy() calls 2 function(s): close, processCompletionsAndHandleOverflow.

Analyze Your Own Codebase

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

Try Supermodel Free