Skip to content

Commit

Permalink
loadbalancer-experimental: Make LoadBalancerObserver public (#2830)
Browse files Browse the repository at this point in the history
Motivation:

We want to let users add custom observer logic but the
interface is private.

Modifications:

- Make the interface public
- Fix the javadocs
  • Loading branch information
bryce-anderson authored Feb 10, 2024
1 parent 796585c commit 836c0cd
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ResolvedAddress> the type of the resolved address.
*/
interface LoadBalancerObserver<ResolvedAddress> {
public interface LoadBalancerObserver<ResolvedAddress> {

/**
* Get a {@link HostObserver}.
* @param resolvedAddress the resolved address of the host.
* @return a {@link HostObserver}.
*/
HostObserver hostObserver(ResolvedAddress resolvedAddress);
Expand All @@ -40,14 +41,19 @@ interface LoadBalancerObserver<ResolvedAddress> {

/**
* 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<? extends ServiceDiscovererEvent<ResolvedAddress>> 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.
Expand Down

0 comments on commit 836c0cd

Please sign in to comment.