Package org.elasticsearch.nio
Class ServerChannelContext
java.lang.Object
org.elasticsearch.nio.ChannelContext<java.nio.channels.ServerSocketChannel>
org.elasticsearch.nio.ServerChannelContext
public class ServerChannelContext extends ChannelContext<java.nio.channels.ServerSocketChannel>
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ServerChannelContext(NioServerSocketChannel channel, ChannelFactory<?,?> channelFactory, NioSelector selector, Config.ServerSocket config, java.util.function.Consumer<NioSocketChannel> acceptor, java.util.function.Consumer<java.lang.Exception> exceptionHandler) -
Method Summary
Modifier and Type Method Description protected static java.nio.channels.SocketChannelaccept(java.nio.channels.ServerSocketChannel serverSocketChannel)voidacceptChannels(java.util.function.Supplier<NioSelector> selectorSupplier)voidaddBindListener(java.util.function.BiConsumer<java.lang.Void,java.lang.Exception> listener)voidcloseChannel()Schedules a channel to be closed by the selector event loop with which it is registered.NioServerSocketChannelgetChannel()NioSelectorgetSelector()protected voidregister()Methods inherited from class org.elasticsearch.nio.ChannelContext
addCloseListener, channelActive, closeFromSelector, getSelectionKey, handleException, isOpen, setSelectionKey
-
Constructor Details
-
ServerChannelContext
public ServerChannelContext(NioServerSocketChannel channel, ChannelFactory<?,?> channelFactory, NioSelector selector, Config.ServerSocket config, java.util.function.Consumer<NioSocketChannel> acceptor, java.util.function.Consumer<java.lang.Exception> exceptionHandler)
-
-
Method Details
-
acceptChannels
public void acceptChannels(java.util.function.Supplier<NioSelector> selectorSupplier) throws java.io.IOException- Throws:
java.io.IOException
-
addBindListener
public void addBindListener(java.util.function.BiConsumer<java.lang.Void,java.lang.Exception> listener) -
register
protected void register() throws java.io.IOException- Overrides:
registerin classChannelContext<java.nio.channels.ServerSocketChannel>- Throws:
java.io.IOException
-
closeChannel
public void closeChannel()Description copied from class:ChannelContextSchedules a channel to be closed by the selector event loop with which it is registered. If the channel is open and the state can be transitioned to closed, the close operation will be scheduled with the event loop. Depending on the underlying protocol of the channel, a close operation might simply close the socket channel or may involve reading and writing messages.- Specified by:
closeChannelin classChannelContext<java.nio.channels.ServerSocketChannel>
-
getSelector
- Specified by:
getSelectorin classChannelContext<java.nio.channels.ServerSocketChannel>
-
getChannel
- Specified by:
getChannelin classChannelContext<java.nio.channels.ServerSocketChannel>
-
accept
protected static java.nio.channels.SocketChannel accept(java.nio.channels.ServerSocketChannel serverSocketChannel) throws java.io.IOException- Throws:
java.io.IOException
-