Package org.elasticsearch.nio
Class ServerChannelContext
java.lang.Object
org.elasticsearch.nio.ChannelContext<ServerSocketChannel>
org.elasticsearch.nio.ServerChannelContext
-
Field Summary
Fields inherited from class org.elasticsearch.nio.ChannelContext
rawChannel -
Constructor Summary
ConstructorsConstructorDescriptionServerChannelContext(NioServerSocketChannel channel, ChannelFactory<?, ?> channelFactory, NioSelector selector, Config.ServerSocket config, Consumer<NioSocketChannel> acceptor, Consumer<Exception> exceptionHandler) -
Method Summary
Modifier and TypeMethodDescriptionprotected static SocketChannelaccept(ServerSocketChannel serverSocketChannel) voidacceptChannels(Supplier<NioSelector> selectorSupplier) voidaddBindListener(BiConsumer<Void, Exception> listener) voidSchedules a channel to be closed by the selector event loop with which it is registered.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, Consumer<NioSocketChannel> acceptor, Consumer<Exception> exceptionHandler)
-
-
Method Details
-
acceptChannels
- Throws:
IOException
-
addBindListener
-
register
- Overrides:
registerin classChannelContext<ServerSocketChannel>- Throws:
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<ServerSocketChannel>
-
getSelector
- Specified by:
getSelectorin classChannelContext<ServerSocketChannel>
-
getChannel
- Specified by:
getChannelin classChannelContext<ServerSocketChannel>
-
accept
- Throws:
IOException
-