Interface ServiceInstance


  • public interface ServiceInstance
    Represents an instance of service.
    • Method Detail

      • getId

        long getId()
        Returns:
        the service id. The service ids are unique per Stork instance.
      • getHost

        String getHost()
        Returns:
        the host of the service.
      • getPort

        int getPort()
        Returns:
        the port of the service.
      • isSecure

        boolean isSecure()
        Returns:
        whether the communication should happen over a secure connection
      • getMetadata

        default Metadata<? extends MetadataKey> getMetadata()
        Returns:
        the metadata of the instance, empty if none.
      • getLabels

        default Map<String,​String> getLabels()
        Returns:
        the labels of the instance, empty if none.
      • gatherStatistics

        default boolean gatherStatistics()
        Returns:
        whether the interaction with the service are monitored, allowing statistic-based load-balancing.
      • recordResult

        default void recordResult​(long timeInNs,
                                  Throwable failure)
        When gatherStatistics is enabled, reports the completion of an operation using this service instance.
        Parameters:
        timeInNs - the duration of the operation in nano-seconds.
        failure - the failure if the operation failed. Can be null.