Interface Transport.Connection

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
CloseableConnection, TcpTransport.NodeChannels
Enclosing interface:
Transport

@PublicApi(since="1.0.0") public static interface Transport.Connection extends Closeable
A unidirectional connection to a DiscoveryNode
Opensearch.api:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addCloseListener(org.opensearch.core.action.ActionListener<Void> listener)
    The listener's ActionListener.onResponse(Object) method will be called when this connection is closed.
    void
     
    default Object
    Returns a key that this connection can be cached on.
    The node this connection is associated with
    default org.opensearch.Version
    Returns the version of the node this connection was established with.
    boolean
     
    void
    sendRequest(long requestId, String action, TransportRequest request, TransportRequestOptions options)
    Sends the request to the node this connection is associated with
  • 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 - see Transport.ResponseHandlers.add(ResponseContext) for details
      action - the action to execute
      request - the request to send
      options - request options to apply
      Throws:
      NodeNotConnectedException - if the given node is not connected
      IOException
      TransportException
    • addCloseListener

      void addCloseListener(org.opensearch.core.action.ActionListener<Void> listener)
      The listener's ActionListener.onResponse(Object) method will be called when this connection is closed. No implementations currently throw an exception during close, so ActionListener.onFailure(Exception) will not be called.
      Parameters:
      listener - to be called
    • isClosed

      boolean isClosed()
    • getVersion

      default org.opensearch.Version getVersion()
      Returns the version of the node this connection was established with.
    • getCacheKey

      default 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 interface AutoCloseable
      Specified by:
      close in interface Closeable