Interface Endpoint

All Superinterfaces:
Stateful<EndpointState>
All Known Implementing Classes:
AnalyticsEndpoint, BackupEndpoint, BaseEndpoint, EventingEndpoint, KeyValueEndpoint, ManagerEndpoint, QueryEndpoint, SearchEndpoint, ViewEndpoint

public interface Endpoint extends Stateful<EndpointState>
The parent interface for all endpoints.

Note that while this interface has been around since the 1.x days, it has been changed up quite a bit to make it simpler and provide more functionality based on real world experience with the first iteration.

Since:
1.0.0
  • Method Details

    • connect

      void connect()
      Instruct this Endpoint to connect.

      This method is async and will return immediately. Use the other methods available to inspect the current state of the endpoint, signaling potential successful connection attempts.

    • disconnect

      void disconnect()
      Instruct this Endpoint to disconnect.

      This method is async and will return immediately. Use the other methods available to inspect the current state of the endpoint, signaling potential successful disconnection attempts.

    • send

      <R extends Request<? extends Response>> void send(R request)
      Sends the request into this Endpoint.

      Note that there is no guarantee that the request will actually dispatched, based on the state this endpoint is in.

      Parameters:
      request - the request to send.
    • freeToWrite

      boolean freeToWrite()
      If new requests can be written to this endpoint
      Returns:
      true if free, false otherwise.
    • outstandingRequests

      long outstandingRequests()
      If this endpoint has one or more outstanding requests.
      Returns:
      the number of outstanding requests
    • lastResponseReceived

      long lastResponseReceived()
      Holds the timestamp of the last response received (or 0 if no request ever sent).
      Returns:
      the timestamp of the last response received, in nanoseconds.
    • lastConnectedAt

      long lastConnectedAt()
      Returns the timestamp when the endpoint was last connected successfully (nanoseconds).
      Returns:
      the timestamp when the endpoint was last connected, in nanoseconds.
    • diagnostics

      EndpointDiagnostics diagnostics()
      Returns diagnostics information for this endpoint.
    • internalDiagnostics

      @Internal InternalEndpointDiagnostics internalDiagnostics()
    • receivedDisconnectSignal

      boolean receivedDisconnectSignal()
      On this endpoint disconnect() has been called on.

      This is different from an endpoint just being disconnected on the remote side and continuing reconnect attempts. Once this returns true, it is never coming back.

      Returns:
      true if disconnect() has been called.
    • context

      EndpointContext context()
      Returns the context for this endpoint.
      Returns:
      the context.
    • remoteHostname

      String remoteHostname()
      Returns the remote hostname this endpoint is connected to (without the port).
    • remotePort

      int remotePort()
      Returns the remotePort this endpoint is connected to.
    • lastConnectAttemptFailure

      Throwable lastConnectAttemptFailure()
      Returns the failure reason of the last connect attempt, if any.
      Returns:
      returns the last failure reason, or null if connected properly or never attempted.