Interface Endpoint

    • Method Detail

      • 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.
      • 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.