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 java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classChannelFactory.RawChannelFactory
-
Constructor Summary
Constructors Modifier Constructor Description protectedChannelFactory(ChannelFactory.RawChannelFactory rawChannelFactory)This will create aChannelFactoryusing the raw channel factory passed to the constructor.
-
Method Summary
Modifier and Type Method Description SocketacceptNioChannel(ServerChannelContext serverContext, java.util.function.Supplier<NioSelector> supplier)abstract SocketcreateChannel(NioSelector selector, java.nio.channels.SocketChannel channel)This method should return a newNioSocketChannelimplementation.abstract ServerSocketcreateServerChannel(NioSelector selector, java.nio.channels.ServerSocketChannel channel)This method should return a newNioServerSocketChannelimplementation.SocketopenNioChannel(java.net.InetSocketAddress remoteAddress, java.util.function.Supplier<NioSelector> supplier)ServerSocketopenNioServerSocketChannel(java.net.InetSocketAddress address, java.util.function.Supplier<NioSelector> supplier)
-
-
-
Constructor Detail
-
ChannelFactory
protected ChannelFactory(ChannelFactory.RawChannelFactory rawChannelFactory)
This will create aChannelFactoryusing the raw channel factory passed to the constructor.- Parameters:
rawChannelFactory- a factory that will construct the raw socket channels
-
-
Method Detail
-
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(ServerChannelContext serverContext, java.util.function.Supplier<NioSelector> supplier) throws java.io.IOException
- Throws:
java.io.IOException
-
openNioServerSocketChannel
public ServerSocket openNioServerSocketChannel(java.net.InetSocketAddress address, 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) throws java.io.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 channel- 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) throws java.io.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 channel- Returns:
- the server channel
- Throws:
java.io.IOException- related to the creation of the channel
-
-