Interface LoadBalancerObserver


public interface LoadBalancerObserver
An observer that provides visibility into a LoadBalancer.
  • Method Details

    • hostObserver

      LoadBalancerObserver.HostObserver hostObserver(Object resolvedAddress)
      Parameters:
      resolvedAddress - the resolved address of the host.
      Returns:
      a LoadBalancerObserver.HostObserver.
    • onServiceDiscoveryEvent

      void onServiceDiscoveryEvent(Collection<? extends ServiceDiscovererEvent<?>> events)
      Callback for monitoring the changes due to a service discovery update.
      Parameters:
      events - the collection of ServiceDiscovererEvents received by the load balancer.
    • onHostsUpdate

      void onHostsUpdate(Collection<? extends LoadBalancerObserver.Host> oldHosts, Collection<? extends LoadBalancerObserver.Host> newHosts)
      Callback for when the set of hosts used by the load balancer has changed. This set may not exactly reflect the state of the service discovery system due to filtering of zero-weight hosts and forms of sub-setting and thus may only represent the hosts that the selection algorithm may use.
      Parameters:
      oldHosts - the old set of hosts used by the selection algorithm.
      newHosts - the new set of hosts used by the selection algorithm.
    • onNoAvailableHostException

      void onNoAvailableHostException(NoAvailableHostException exception)
      Callback for when connection selection fails due to no hosts being available.
      Parameters:
      exception - an exception with more details about the failure.
    • onNoActiveHostException

      void onNoActiveHostException(Collection<? extends LoadBalancerObserver.Host> hosts, NoActiveHostException exception)
      Callback for when connection selection fails due to all hosts being inactive.
      Parameters:
      hosts - the set of hosts that is eligible for selection.
      exception - an exception with more details about the failure.