Package org.elasticsearch.nio
Class NioChannel
- java.lang.Object
-
- org.elasticsearch.nio.NioChannel
-
- Direct Known Subclasses:
NioServerSocketChannel,NioSocketChannel
public abstract class NioChannel extends java.lang.ObjectThis is a basic channel abstraction used by theNioSelector.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 Constructor Description NioChannel()
-
Method Summary
Modifier and Type Method Description voidaddCloseListener(java.util.function.BiConsumer<java.lang.Void,java.lang.Exception> listener)Adds a close listener to the channel.voidclose()Schedules channel for close.abstract ChannelContext<?>getContext()abstract java.net.InetSocketAddressgetLocalAddress()abstract java.nio.channels.NetworkChannelgetRawChannel()booleanisOpen()
-
-
-
Method Detail
-
isOpen
public boolean isOpen()
-
addCloseListener
public void addCloseListener(java.util.function.BiConsumer<java.lang.Void,java.lang.Exception> listener)
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
public abstract java.net.InetSocketAddress getLocalAddress()
-
getRawChannel
public abstract java.nio.channels.NetworkChannel getRawChannel()
-
getContext
public abstract ChannelContext<?> getContext()
-
-