Class ReopeningInterruptibleChannel<T extends java.nio.channels.InterruptibleChannel>

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.Channel, java.nio.channels.InterruptibleChannel

    public final class ReopeningInterruptibleChannel<T extends java.nio.channels.InterruptibleChannel>
    extends java.lang.Object
    implements java.nio.channels.InterruptibleChannel
    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • channelFactory

        private final java.util.function.Supplier<T extends java.nio.channels.InterruptibleChannel> channelFactory
      • currentChannel

        private final java.util.concurrent.atomic.AtomicReference<T extends java.nio.channels.InterruptibleChannel> currentChannel
    • Constructor Detail

      • ReopeningInterruptibleChannel

        private ReopeningInterruptibleChannel​(java.util.function.Supplier<T> deviceFactory)
    • Method Detail

      • create

        public static <T extends java.nio.channels.InterruptibleChannel> ReopeningInterruptibleChannel<T> create​(java.util.function.Supplier<T> channelFactory)
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface java.nio.channels.Channel
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.nio.channels.Channel
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface java.nio.channels.InterruptibleChannel
        Throws:
        java.io.IOException