Class ChannelFactory<ServerSocket extends NioServerSocketChannel,​Socket extends NioSocketChannel>

java.lang.Object
org.elasticsearch.nio.ChannelFactory<ServerSocket,​Socket>

public abstract class ChannelFactory<ServerSocket extends NioServerSocketChannel,​Socket extends NioSocketChannel>
extends java.lang.Object
  • Constructor Details

    • ChannelFactory

      protected ChannelFactory​(boolean tcpNoDelay, boolean tcpKeepAlive, int tcpKeepIdle, int tcpKeepInterval, int tcpKeepCount, boolean tcpReuseAddress, int tcpSendBufferSize, int tcpReceiveBufferSize)
      This will create a ChannelFactory.
    • ChannelFactory

      protected ChannelFactory​(boolean tcpNoDelay, boolean tcpKeepAlive, int tcpKeepIdle, int tcpKeepInterval, int tcpKeepCount, boolean tcpReuseAddress, int tcpSendBufferSize, int tcpReceiveBufferSize, ChannelFactory.RawChannelFactory rawChannelFactory)
      This will create a ChannelFactory using the raw channel factory passed to the constructor.
  • Method Details

    • openNioChannel

      public Socket openNioChannel​(java.net.InetSocketAddress remoteAddress, java.util.function.Supplier<NioSelector> supplier) throws java.io.IOException
      Throws:
      java.io.IOException
    • acceptNioChannel

      public Socket acceptNioChannel​(java.nio.channels.SocketChannel rawChannel, java.util.function.Supplier<NioSelector> supplier) throws java.io.IOException
      Throws:
      java.io.IOException
    • openNioServerSocketChannel

      public ServerSocket openNioServerSocketChannel​(java.net.InetSocketAddress localAddress, java.util.function.Supplier<NioSelector> supplier) throws java.io.IOException
      Throws:
      java.io.IOException
    • createChannel

      public abstract Socket createChannel​(NioSelector selector, java.nio.channels.SocketChannel channel, Config.Socket socketConfig) throws java.io.IOException
      This method should return a new NioSocketChannel implementation. When this method has returned, the channel should be fully created and setup. Read and write contexts and the channel exception handler should have been set.
      Parameters:
      selector - the channel will be registered with
      channel - the raw channel
      socketConfig - the socket config
      Returns:
      the channel
      Throws:
      java.io.IOException - related to the creation of the channel
    • createServerChannel

      public abstract ServerSocket createServerChannel​(NioSelector selector, java.nio.channels.ServerSocketChannel channel, Config.ServerSocket socketConfig) throws java.io.IOException
      This method should return a new NioServerSocketChannel implementation. When this method has returned, the channel should be fully created and setup.
      Parameters:
      selector - the channel will be registered with
      channel - the raw channel
      socketConfig - the socket config
      Returns:
      the server channel
      Throws:
      java.io.IOException - related to the creation of the channel
    • getRemoteAddress

      protected java.net.InetSocketAddress getRemoteAddress​(java.nio.channels.SocketChannel rawChannel) throws java.io.IOException
      Throws:
      java.io.IOException