diff --git a/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/DefaultLoadBalancerBuilder.java b/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/DefaultLoadBalancerBuilder.java index 19ab7aa79b..6de8228621 100644 --- a/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/DefaultLoadBalancerBuilder.java +++ b/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/DefaultLoadBalancerBuilder.java @@ -39,7 +39,7 @@ final class DefaultLoadBalancerBuilder loadBalancingPolicy = defaultLoadBalancingPolicy(); + private LoadBalancingPolicy loadBalancingPolicy = LoadBalancingPolicies.defaultPolicy(); private ConnectionPoolPolicy connectionPoolPolicy = ConnectionPoolPolicies.defaultPolicy();; private OutlierDetectorConfig outlierDetectorConfig = OutlierDetectorConfig.DEFAULT_CONFIG; @@ -181,9 +181,4 @@ private Executor getExecutor() { return backgroundExecutor == null ? RoundRobinLoadBalancerFactory.SharedExecutor.getInstance() : backgroundExecutor; } - - private static - LoadBalancingPolicy defaultLoadBalancingPolicy() { - return LoadBalancingPolicies.roundRobin().build(); - } } diff --git a/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/LoadBalancingPolicies.java b/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/LoadBalancingPolicies.java index 260e8008d0..bdcd410853 100644 --- a/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/LoadBalancingPolicies.java +++ b/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/LoadBalancingPolicies.java @@ -15,6 +15,8 @@ */ package io.servicetalk.loadbalancer; +import io.servicetalk.client.api.LoadBalancedConnection; + /** * A collections of factories for constructing a {@link LoadBalancingPolicy}. */ @@ -24,6 +26,15 @@ private LoadBalancingPolicies() { // no instances. } + /** + * Get the recommended default {@link LoadBalancingPolicy}. + * @return the recommended default {@link LoadBalancingPolicy}. + */ + public static + LoadBalancingPolicy defaultPolicy() { + return LoadBalancingPolicies.roundRobin().build(); + } + /** * Builder for the round-robin {@link LoadBalancingPolicy}. * Round-robin load balancing is a strategy that maximizes fairness of the request distribution. This comes at the