Class AbstractNioWorker

    • Constructor Detail

      • AbstractNioWorker

        AbstractNioWorker​(java.util.concurrent.Executor executor)
      • AbstractNioWorker

        AbstractNioWorker​(java.util.concurrent.Executor executor,
                          ThreadNameDeterminer determiner)
    • Method Detail

      • executeInIoThread

        public void executeInIoThread​(java.lang.Runnable task)
        Description copied from interface: Worker
        Execute the given Runnable in the IO-Thread. This may be now or later once the IO-Thread do some other work.
        Specified by:
        executeInIoThread in interface Worker
        Parameters:
        task - the Runnable to execute
      • executeInIoThread

        public void executeInIoThread​(java.lang.Runnable task,
                                      boolean alwaysAsync)
        Execute the Runnable in a IO-Thread
        Parameters:
        task - the Runnable to execute
        alwaysAsync - true if the Runnable should be executed in an async fashion even if the current Thread == IO Thread
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class AbstractNioSelector
      • process

        protected void process​(java.nio.channels.Selector selector)
                        throws java.io.IOException
        Specified by:
        process in class AbstractNioSelector
        Throws:
        java.io.IOException
      • writeFromSelectorLoop

        void writeFromSelectorLoop​(java.nio.channels.SelectionKey k)
      • scheduleWriteIfNecessary

        protected abstract boolean scheduleWriteIfNecessary​(AbstractNioChannel<?> channel)
      • cleanUpWriteBuffer

        protected static void cleanUpWriteBuffer​(AbstractNioChannel<?> channel)
      • read

        protected abstract boolean read​(java.nio.channels.SelectionKey k)
        Read is called when a Selector has been notified that the underlying channel was something to be read. The channel would previously have registered its interest in read operations.
        Parameters:
        k - The selection key which contains the Selector registration information.