- All Superinterfaces:
AutoCloseable,Closeable,RefCounted
- All Known Implementing Classes:
CloseableConnection,TcpTransport.NodeChannels
- Enclosing interface:
Transport
A unidirectional connection to a
DiscoveryNode-
Field Summary
Fields inherited from interface org.elasticsearch.core.RefCounted
ALWAYS_REFERENCED -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCloseListener(ActionListener<Void> listener) The listener will be called when this connection has completed closing.voidaddRemovedListener(ActionListener<Void> listener) Similar toaddCloseListener(org.elasticsearch.action.ActionListener<java.lang.Void>)except that these listeners are notified once the connection is removed from the transport service.voidclose()default ObjectReturns a key that this connection can be cached on.getNode()The node this connection is associated withReturns the version of the data to communicate in this channel.booleanisClosed()voidCalled after this connection is removed from the transport service.voidsendRequest(long requestId, String action, TransportRequest request, TransportRequestOptions options) Sends the request to the node this connection is associated withMethods inherited from interface org.elasticsearch.core.RefCounted
decRef, hasReferences, incRef, mustIncRef, tryIncRef
-
Method Details
-
getNode
DiscoveryNode getNode()The node this connection is associated with -
sendRequest
void sendRequest(long requestId, String action, TransportRequest request, TransportRequestOptions options) throws IOException, TransportException Sends the request to the node this connection is associated with- Parameters:
requestId- seeTransport.ResponseHandlers.add(TransportResponseHandler, Connection, String)for detailsaction- the action to executerequest- the request to sendoptions- request options to apply- Throws:
NodeNotConnectedException- if the given node is not connectedIOExceptionTransportException
-
addCloseListener
The listener will be called when this connection has completed closing. TheActionListener.onResponse(Object)method will be called when the connection closed gracefully, and theActionListener.onFailure(Exception)method will be called when the connection has successfully closed, but an exception has prompted the close.- Parameters:
listener- to be called
-
isClosed
boolean isClosed() -
getTransportVersion
TransportVersion getTransportVersion()Returns the version of the data to communicate in this channel. -
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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
onRemoved
void onRemoved()Called after this connection is removed from the transport service. -
addRemovedListener
Similar toaddCloseListener(org.elasticsearch.action.ActionListener<java.lang.Void>)except that these listeners are notified once the connection is removed from the transport service.
-