Package org.elasticsearch.transport
Interface Transport.Connection
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
- All Known Implementing Classes:
CloseableConnection
,TcpTransport.NodeChannels
- Enclosing interface:
- Transport
public static interface Transport.Connection extends java.io.Closeable
A unidirectional connection to aDiscoveryNode
-
-
Method Summary
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()
default java.lang.Object
getCacheKey()
Returns a key that this connection can be cached on.DiscoveryNode
getNode()
The node this connection is associated withdefault Version
getVersion()
Returns the version of the node this connection was established with.boolean
isClosed()
void
sendRequest(long requestId, java.lang.String action, TransportRequest request, TransportRequestOptions options)
Sends the request to the node this connection is associated with
-
-
-
Method Detail
-
getNode
DiscoveryNode getNode()
The node this connection is associated with
-
sendRequest
void sendRequest(long requestId, java.lang.String action, TransportRequest request, TransportRequestOptions options) throws java.io.IOException, TransportException
Sends the request to the node this connection is associated with- Parameters:
requestId
- seeTransport.ResponseHandlers.add(ResponseContext)
for detailsaction
- the action to executerequest
- the request to sendoptions
- request options to apply- Throws:
NodeNotConnectedException
- if the given node is not connectedjava.io.IOException
TransportException
-
addCloseListener
void addCloseListener(ActionListener<java.lang.Void> listener)
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.- Parameters:
listener
- to be called
-
isClosed
boolean isClosed()
-
getVersion
default Version getVersion()
Returns the version of the node this connection was established with.
-
getCacheKey
default java.lang.Object getCacheKey()
Returns a key that this connection can be cached on. Delegating subclasses must delegate method call to the original connection.
-
close
void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-