Package org.elasticsearch.nio
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 Object
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedChannelFactory(boolean tcpNoDelay, boolean tcpKeepAlive, int tcpKeepIdle, int tcpKeepInterval, int tcpKeepCount, boolean tcpReuseAddress, int tcpSendBufferSize, int tcpReceiveBufferSize) This will create aChannelFactory.protectedChannelFactory(boolean tcpNoDelay, boolean tcpKeepAlive, int tcpKeepIdle, int tcpKeepInterval, int tcpKeepCount, boolean tcpReuseAddress, int tcpSendBufferSize, int tcpReceiveBufferSize, ChannelFactory.RawChannelFactory rawChannelFactory) This will create aChannelFactoryusing the raw channel factory passed to the constructor. -
Method Summary
Modifier and TypeMethodDescriptionacceptNioChannel(SocketChannel rawChannel, Supplier<NioSelector> supplier) abstract SocketcreateChannel(NioSelector selector, SocketChannel channel, Config.Socket socketConfig) This method should return a newNioSocketChannelimplementation.abstract ServerSocketcreateServerChannel(NioSelector selector, ServerSocketChannel channel, Config.ServerSocket socketConfig) This method should return a newNioServerSocketChannelimplementation.protected InetSocketAddressgetRemoteAddress(SocketChannel rawChannel) openNioChannel(InetSocketAddress remoteAddress, Supplier<NioSelector> supplier) openNioServerSocketChannel(InetSocketAddress localAddress, Supplier<NioSelector> supplier)
-
Constructor Details
-
ChannelFactory
protected ChannelFactory(boolean tcpNoDelay, boolean tcpKeepAlive, int tcpKeepIdle, int tcpKeepInterval, int tcpKeepCount, boolean tcpReuseAddress, int tcpSendBufferSize, int tcpReceiveBufferSize) This will create aChannelFactory. -
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 aChannelFactoryusing the raw channel factory passed to the constructor.
-
-
Method Details
-
openNioChannel
public Socket openNioChannel(InetSocketAddress remoteAddress, Supplier<NioSelector> supplier) throws IOException - Throws:
IOException
-
acceptNioChannel
public Socket acceptNioChannel(SocketChannel rawChannel, Supplier<NioSelector> supplier) throws IOException - Throws:
IOException
-
openNioServerSocketChannel
public ServerSocket openNioServerSocketChannel(InetSocketAddress localAddress, Supplier<NioSelector> supplier) throws IOException - Throws:
IOException
-
createChannel
public abstract Socket createChannel(NioSelector selector, SocketChannel channel, Config.Socket socketConfig) throws IOException This method should return a newNioSocketChannelimplementation. 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 withchannel- the raw channelsocketConfig- the socket config- Returns:
- the channel
- Throws:
IOException- related to the creation of the channel
-
createServerChannel
public abstract ServerSocket createServerChannel(NioSelector selector, ServerSocketChannel channel, Config.ServerSocket socketConfig) throws IOException This method should return a newNioServerSocketChannelimplementation. When this method has returned, the channel should be fully created and setup.- Parameters:
selector- the channel will be registered withchannel- the raw channelsocketConfig- the socket config- Returns:
- the server channel
- Throws:
IOException- related to the creation of the channel
-
getRemoteAddress
- Throws:
IOException
-