Package io.servicetalk.loadbalancer
Interface LoadBalancerObserver
public interface LoadBalancerObserver
An observer that provides visibility into a
LoadBalancer.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA description of a host.static interfaceAn observer forHostevents. -
Method Summary
Modifier and TypeMethodDescriptionhostObserver(Object resolvedAddress) voidonHostsUpdate(Collection<? extends LoadBalancerObserver.Host> oldHosts, Collection<? extends LoadBalancerObserver.Host> newHosts) Callback for when the set of hosts used by the load balancer has changed.voidonNoActiveHostException(Collection<? extends LoadBalancerObserver.Host> hosts, NoActiveHostException exception) Callback for when connection selection fails due to all hosts being inactive.voidCallback for when connection selection fails due to no hosts being available.voidonServiceDiscoveryEvent(Collection<? extends ServiceDiscovererEvent<?>> events) Callback for monitoring the changes due to a service discovery update.
-
Method Details
-
hostObserver
- Parameters:
resolvedAddress- the resolved address of the host.- Returns:
- a
LoadBalancerObserver.HostObserver.
-
onServiceDiscoveryEvent
Callback for monitoring the changes due to a service discovery update.- Parameters:
events- the collection ofServiceDiscovererEvents 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
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.
-