Class EpollIoHandler

  • All Implemented Interfaces:
    IoHandler

    public class EpollIoHandler
    extends java.lang.Object
    implements IoHandler
    IoHandler which uses epoll under the covers. Only works on Linux!
    • Method Detail

      • openFileDescriptors

        @UnstableApi
        public void openFileDescriptors()
        This method is intended for use by a process checkpoint/restore integration, such as OpenJDK CRaC.
      • closeFileDescriptor

        private static void closeFileDescriptor​(FileDescriptor fd)
      • 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
      • 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
      • 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.
      • 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.
      • numRegisteredChannels

        int numRegisteredChannels()
      • registeredChannelsList

        java.util.List<Channel> registeredChannelsList()
      • epollWait

        private long epollWait​(IoHandlerContext context,
                               long deadlineNanos)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • epollWaitNoTimerChange

        private int epollWaitNoTimerChange()
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • epollWaitNow

        private int epollWaitNow()
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • epollBusyWait

        private int epollBusyWait()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • epollWaitTimeboxed

        private int epollWaitTimeboxed()
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • handleLoopException

        void handleLoopException​(java.lang.Throwable t)
        Visible only for testing!
      • processReady

        private int processReady​(EpollEventArray events,
                                 int ready)
      • closeFileDescriptors

        @UnstableApi
        public void closeFileDescriptors()
        This method is intended for use by process checkpoint/restore integration, such as OpenJDK CRaC. It's up to the caller to ensure that there is no concurrent use of the FDs while these are closed, e.g. by blocking the executor.