Package org.elasticsearch.transport
Class CloseableConnection
java.lang.Object
org.elasticsearch.transport.CloseableConnection
- All Implemented Interfaces:
Closeable,AutoCloseable,Transport.Connection
- Direct Known Subclasses:
TcpTransport.NodeChannels
Abstract Transport.Connection that provides common close logic.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCloseListener(ActionListener<Void> listener)The listener'sActionListener.onResponse(Object)method will be called when this connection is closed.voidclose()booleanisClosed()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.transport.Transport.Connection
getCacheKey, getNode, getVersion, sendRequest
-
Constructor Details
-
CloseableConnection
public CloseableConnection()
-
-
Method Details
-
addCloseListener
Description copied from interface:Transport.ConnectionThe listener'sActionListener.onResponse(Object)method will be called when this connection is closed. No implementations currently throw an exception during close, soActionListener.onFailure(Exception)will not be called.- Specified by:
addCloseListenerin interfaceTransport.Connection- Parameters:
listener- to be called
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceTransport.Connection
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceTransport.Connection
-