Class IoUringIoHandler

  • All Implemented Interfaces:
    IoHandler

    public final class IoUringIoHandler
    extends java.lang.Object
    implements IoHandler
    IoHandler which is implemented in terms of the Linux-specific io_uring API.
    • Field Detail

      • inet4AddressArray

        private final byte[] inet4AddressArray
      • inet6AddressArray

        private final byte[] inet6AddressArray
      • eventfdAsyncNotify

        private final java.util.concurrent.atomic.AtomicBoolean eventfdAsyncNotify
      • wakeupWriters

        private final java.util.concurrent.atomic.AtomicInteger wakeupWriters
      • eventfdReadBuf

        private final java.nio.ByteBuffer eventfdReadBuf
      • eventfdReadBufAddress

        private final long eventfdReadBufAddress
      • timeoutMemory

        private final java.nio.ByteBuffer timeoutMemory
      • timeoutMemoryAddress

        private final long timeoutMemoryAddress
      • iovArray

        private final IovArray iovArray
      • eventfdReadSubmitted

        private long eventfdReadSubmitted
      • eventFdClosing

        private boolean eventFdClosing
      • shuttingDown

        private volatile boolean shuttingDown
      • closeCompleted

        private boolean closeCompleted
      • nextRegistrationId

        private int nextRegistrationId
      • EVENTFD_TOKEN

        private static final long EVENTFD_TOKEN
      • RINGFD_TOKEN

        private static final long RINGFD_TOKEN
      • KERNEL_TIMESPEC_TV_SEC_FIELD

        private static final int KERNEL_TIMESPEC_TV_SEC_FIELD
        See Also:
        Constant Field Values
      • KERNEL_TIMESPEC_TV_NSEC_FIELD

        private static final int KERNEL_TIMESPEC_TV_NSEC_FIELD
        See Also:
        Constant Field Values
    • Method Detail

      • submitIfFullAndGetRemaining

        int submitIfFullAndGetRemaining()
      • needSubmit

        private boolean needSubmit​(int sqFlags)
      • submitAndClearNow

        private int submitAndClearNow​(SubmissionQueue submissionQueue)
      • submitAndClearNow0

        private int submitAndClearNow0​(SubmissionQueue submissionQueue)
      • handleLoopException

        private static void handleLoopException​(java.lang.Throwable throwable)
      • handle

        private boolean handle​(int res,
                               int flags,
                               long udata,
                               java.nio.ByteBuffer extraCqeData)
      • handleFastPath

        private void handleFastPath​(int res,
                                    int flags,
                                    long udata,
                                    java.nio.ByteBuffer extraCqeData)
      • handleSlowPath

        private void handleSlowPath​(int res,
                                    int flags,
                                    long udata,
                                    java.nio.ByteBuffer extraCqeData)
      • handleEventFdRead

        private void handleEventFdRead()
      • submitEventFdRead

        private void submitEventFdRead()
      • submitAndWaitWithTimeout

        private int submitAndWaitWithTimeout​(SubmissionQueue submissionQueue,
                                             boolean linkTimeout,
                                             long timeoutNanoSeconds)
      • destroy

        public void destroy()
        Description copied from interface: IoHandler
        Destroy the IoHandler and free all its resources. Once destroyed using the IoHandler will cause undefined behaviour.
        Specified by:
        destroy in interface IoHandler
      • drainEventFd

        private void drainEventFd()
      • completeRingClose

        private void completeRingClose()
      • register

        public IoRegistration register​(IoHandle handle)
                                throws java.lang.Exception
        Description copied from interface: IoHandler
        Register a IoHandle for IO.
        Specified by:
        register in interface IoHandler
        Parameters:
        handle - the IoHandle to register.
        Throws:
        java.lang.Exception - thrown if an error happens during registration.
      • nextRegistrationId

        private int nextRegistrationId()
      • wakeup

        public void wakeup()
        Description copied from interface: IoHandler
        Wakeup the IoHandler, which means if any operation blocks it should be unblocked and return as soon as possible.
        Specified by:
        wakeup in interface IoHandler
      • closeWakeupGate

        private void closeWakeupGate()
      • isCompatible

        public boolean isCompatible​(java.lang.Class<? extends IoHandle> handleType)
        Description copied from interface: IoHandler
        Returns true if the given type is compatible with this IoHandler and so can be registered, false otherwise.
        Specified by:
        isCompatible in interface IoHandler
        Parameters:
        handleType - the type of the IoHandle.
        Returns:
        if compatible of not.
      • inet4AddressArray

        byte[] inet4AddressArray()
        byte[] that can be used as temporary storage to encode the ipv4 address
      • inet6AddressArray

        byte[] inet6AddressArray()
        byte[] that can be used as temporary storage to encode the ipv6 address