Class NioChannel

java.lang.Object
org.elasticsearch.nio.NioChannel
Direct Known Subclasses:
NioServerSocketChannel, NioSocketChannel

public abstract class NioChannel extends Object
This is a basic channel abstraction used by the NioSelector.

A channel is open once it is constructed. The channel remains open and isOpen() will return true until the channel is explicitly closed.

  • Constructor Details

    • NioChannel

      public NioChannel()
  • Method Details

    • isOpen

      public boolean isOpen()
    • addCloseListener

      public void addCloseListener(BiConsumer<Void,Exception> listener)
      Adds a close listener to the channel. Multiple close listeners can be added. There is no guarantee about the order in which close listeners will be executed. If the channel is already closed, the listener is executed immediately.
      Parameters:
      listener - to be called at close
    • close

      public void close()
      Schedules channel for close. This process is asynchronous.
    • getLocalAddress

      public abstract InetSocketAddress getLocalAddress()
    • getRawChannel

      public abstract NetworkChannel getRawChannel()
    • getContext

      public abstract ChannelContext<?> getContext()