From 1e2e7707aa4835f7fcf5eaca040272a60494da17 Mon Sep 17 00:00:00 2001 From: Bryce Anderson Date: Thu, 19 Dec 2024 16:01:47 -0700 Subject: [PATCH] loadbalancer: deprecate RoundRobinLoadBalancer types Motivation: We're switching over to the new load balancer API's, but we still have the older API's sitting around. Modifications: Deprecate the old API's and point users to the new. --- .../io/servicetalk/loadbalancer/RoundRobinLoadBalancer.java | 1 + .../loadbalancer/RoundRobinLoadBalancerBuilder.java | 3 +++ .../loadbalancer/RoundRobinLoadBalancerBuilderProvider.java | 4 +++- .../loadbalancer/RoundRobinLoadBalancerFactory.java | 4 ++-- .../servicetalk/loadbalancer/RoundRobinLoadBalancers.java | 6 +++++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancer.java b/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancer.java index de3e58c67b..f8c1749058 100644 --- a/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancer.java +++ b/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancer.java @@ -95,6 +95,7 @@ * @param The resolved address type. * @param The type of connection. */ +// FIXME: 0.43 - remove deprecated class final class RoundRobinLoadBalancer implements TestableLoadBalancer { diff --git a/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerBuilder.java b/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerBuilder.java index bbbd9b6350..b23847a5a6 100644 --- a/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerBuilder.java +++ b/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerBuilder.java @@ -63,7 +63,10 @@ * @param The resolved address type. * @param The type of connection. * @see RoundRobinLoadBalancers + * @deprecated use {@link LoadBalancerBuilder} interfaces instead. */ +// FIXME: 0.43 - remove deprecated interface +@Deprecated public interface RoundRobinLoadBalancerBuilder { /** diff --git a/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerBuilderProvider.java b/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerBuilderProvider.java index 4f57a57521..059ced1bd5 100644 --- a/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerBuilderProvider.java +++ b/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerBuilderProvider.java @@ -19,8 +19,10 @@ /** * Provider for {@link RoundRobinLoadBalancerBuilder} that can be registered using {@link java.util.ServiceLoader}. + * @deprecated use the {@link LoadBalancerBuilder} implementations along with {@link LoadBalancerBuilderProvider} */ -public interface RoundRobinLoadBalancerBuilderProvider { +@Deprecated +public interface RoundRobinLoadBalancerBuilderProvider { // FIXME: 0.43 - remove deprecated interface /** * Returns a {@link RoundRobinLoadBalancerBuilder} based on the pre-initialized diff --git a/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerFactory.java b/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerFactory.java index 1dd681a440..7cacc99bb5 100644 --- a/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerFactory.java +++ b/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerFactory.java @@ -51,7 +51,7 @@ * @deprecated this class will be made package-private in the future, use {@link RoundRobinLoadBalancers} to create * {@link RoundRobinLoadBalancerBuilder}. */ -@Deprecated // FIXME: 0.43 - make package private +@Deprecated // FIXME: 0.43 - remove in favor of DefaultLoadBalancer types. public final class RoundRobinLoadBalancerFactory implements LoadBalancerFactory { @@ -110,7 +110,7 @@ public String toString() { * @deprecated this class will be made package-private in the future, rely on the * {@link RoundRobinLoadBalancerBuilder} instead. */ - @Deprecated // FIXME: 0.43 - make package private + @Deprecated // FIXME: 0.43 - Remove in favor of the DefaultLoadBalancer types. public static final class Builder implements RoundRobinLoadBalancerBuilder { private final String id; diff --git a/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancers.java b/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancers.java index 5332baf37c..7f4a817433 100644 --- a/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancers.java +++ b/servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancers.java @@ -26,8 +26,10 @@ /** * A factory to create {@link RoundRobinLoadBalancer RoundRobinLoadBalancers}. + * @deprecated use {@link LoadBalancers} instead. */ -public final class RoundRobinLoadBalancers { +@Deprecated +public final class RoundRobinLoadBalancers { // FIXME: 0.43 - remove deprecated class private static final Logger LOGGER = LoggerFactory.getLogger(RoundRobinLoadBalancers.class); private static final List PROVIDERS; @@ -59,8 +61,10 @@ RoundRobinLoadBalancerBuilder applyProviders( * @param The resolved address type. * @param The type of connection. * @return a new {@link RoundRobinLoadBalancerBuilder}. + * @deprecated use {#{@link LoadBalancers}} constructors instead. */ @SuppressWarnings("deprecation") + @Deprecated public static RoundRobinLoadBalancerBuilder builder(final String id) { return applyProviders(id, new RoundRobinLoadBalancerFactory.Builder<>(id));