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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCloseListener(ActionListener<Void> listener)
The listener'sActionListener.onResponse(Object)
method will be called when this connection is closed.void
close()
boolean
isClosed()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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.Connection
The 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:
addCloseListener
in interfaceTransport.Connection
- Parameters:
listener
- to be called
-
isClosed
public boolean isClosed()- Specified by:
isClosed
in interfaceTransport.Connection
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceTransport.Connection
-