Package org.elasticsearch.nio
Class NioChannel
java.lang.Object
org.elasticsearch.nio.NioChannel
- Direct Known Subclasses:
NioServerSocketChannel,NioSocketChannel
This is a basic channel abstraction used by the
NioSelector.
A channel is open once it is constructed. The channel remains open and isOpen() will return
true until the channel is explicitly closed.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCloseListener(BiConsumer<Void, Exception> listener) Adds a close listener to the channel.voidclose()Schedules channel for close.abstract ChannelContext<?>abstract InetSocketAddressabstract NetworkChannelbooleanisOpen()
-
Constructor Details
-
NioChannel
public NioChannel()
-
-
Method Details
-
isOpen
public boolean isOpen() -
addCloseListener
Adds a close listener to the channel. Multiple close listeners can be added. There is no guarantee about the order in which close listeners will be executed. If the channel is already closed, the listener is executed immediately.- Parameters:
listener- to be called at close
-
close
public void close()Schedules channel for close. This process is asynchronous. -
getLocalAddress
-
getRawChannel
-
getContext
-