Package org.elasticsearch.transport
Class CloseableConnection
- java.lang.Object
-
- org.elasticsearch.transport.CloseableConnection
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,Transport.Connection
- Direct Known Subclasses:
TcpTransport.NodeChannels
public abstract class CloseableConnection extends java.lang.Object implements Transport.Connection
Abstract Transport.Connection that provides common close logic.
-
-
Constructor Summary
Constructors Constructor Description CloseableConnection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCloseListener(ActionListener<java.lang.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
-
-
-
-
Method Detail
-
addCloseListener
public void addCloseListener(ActionListener<java.lang.Void> listener)
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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceTransport.Connection
-
-