From 836c0cd17551cfb8c3887d45b77b704afd156f44 Mon Sep 17 00:00:00 2001 From: Bryce Anderson Date: Fri, 9 Feb 2024 17:19:49 -0700 Subject: [PATCH] loadbalancer-experimental: Make LoadBalancerObserver public (#2830) Motivation: We want to let users add custom observer logic but the interface is private. Modifications: - Make the interface public - Fix the javadocs --- .../loadbalancer/LoadBalancerObserver.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancerObserver.java b/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancerObserver.java index e79b478588..8d67ea60a2 100644 --- a/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancerObserver.java +++ b/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancerObserver.java @@ -22,13 +22,14 @@ import javax.annotation.Nullable; /** - * An observer that provides visibility into a {@link io.servicetalk.client.api.LoadBalancer} + * An observer that provides visibility into a {@link io.servicetalk.client.api.LoadBalancer}. * @param the type of the resolved address. */ -interface LoadBalancerObserver { +public interface LoadBalancerObserver { /** * Get a {@link HostObserver}. + * @param resolvedAddress the resolved address of the host. * @return a {@link HostObserver}. */ HostObserver hostObserver(ResolvedAddress resolvedAddress); @@ -40,14 +41,19 @@ interface LoadBalancerObserver { /** * Callback for monitoring the changes due to a service discovery update. + * @param events the collection of {@link ServiceDiscovererEvent}s received by the load balancer. + * @param oldHostSetSize the size of the previous host set. + * @param newHostSetSize the new size of the host set. */ void onServiceDiscoveryEvent(Collection> events, int oldHostSetSize, int newHostSetSize); /** * Callback for when connection selection fails due to all hosts being inactive. + * @param hostSetSize the size of the current host set. + * @param exception an exception with more details about the failure. */ - void onNoActiveHostsAvailable(int hostSetSize, NoActiveHostException exn); + void onNoActiveHostsAvailable(int hostSetSize, NoActiveHostException exception); /** * An observer for {@link Host} events.