Skip to content

Commit 6fc7987

Browse files
loadbalancer: deprecate RoundRobinLoadBalancer types (#3149)
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 direct users to the new.
1 parent 441c2bc commit 6fc7987

6 files changed

+20
-9
lines changed

servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/DelegatingRoundRobinLoadBalancerBuilder.java

+2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
*
2929
* @param <ResolvedAddress> The resolved address type.
3030
* @param <C> The type of connection.
31+
* @deprecated use {@link DelegatingLoadBalancerBuilder} instead.
3132
*/
33+
@Deprecated // FIXME: 0.43 - Remove in favor of the DefaultLoadBalancer types
3234
public class DelegatingRoundRobinLoadBalancerBuilder<ResolvedAddress, C extends LoadBalancedConnection>
3335
implements RoundRobinLoadBalancerBuilder<ResolvedAddress, C> {
3436

servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancer.java

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
* @param <ResolvedAddress> The resolved address type.
9696
* @param <C> The type of connection.
9797
*/
98+
// FIXME: 0.43 - remove deprecated class
9899
final class RoundRobinLoadBalancer<ResolvedAddress, C extends LoadBalancedConnection>
99100
implements TestableLoadBalancer<ResolvedAddress, C> {
100101

servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerBuilder.java

+3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@
6363
* @param <ResolvedAddress> The resolved address type.
6464
* @param <C> The type of connection.
6565
* @see RoundRobinLoadBalancers
66+
* @deprecated use {@link LoadBalancerBuilder} interfaces instead.
6667
*/
68+
// FIXME: 0.43 - remove deprecated interface
69+
@Deprecated
6770
public interface RoundRobinLoadBalancerBuilder<ResolvedAddress, C extends LoadBalancedConnection> {
6871

6972
/**

servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerBuilderProvider.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919

2020
/**
2121
* Provider for {@link RoundRobinLoadBalancerBuilder} that can be registered using {@link java.util.ServiceLoader}.
22+
* @deprecated use the {@link LoadBalancerBuilder} implementations along with {@link LoadBalancerBuilderProvider}
2223
*/
23-
public interface RoundRobinLoadBalancerBuilderProvider {
24+
@Deprecated
25+
public interface RoundRobinLoadBalancerBuilderProvider { // FIXME: 0.43 - remove deprecated interface
2426

2527
/**
2628
* Returns a {@link RoundRobinLoadBalancerBuilder} based on the pre-initialized

servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerFactory.java

+6-7
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848
*
4949
* @param <ResolvedAddress> The resolved address type.
5050
* @param <C> The type of connection.
51-
* @deprecated this class will be made package-private in the future, use {@link RoundRobinLoadBalancers} to create
51+
* @deprecated use {@link LoadBalancers} to create {@link LoadBalancerFactory} instances.
5252
* {@link RoundRobinLoadBalancerBuilder}.
5353
*/
54-
@Deprecated // FIXME: 0.43 - make package private
54+
@Deprecated // FIXME: 0.43 - remove in favor of DefaultLoadBalancer types.
5555
public final class RoundRobinLoadBalancerFactory<ResolvedAddress, C extends LoadBalancedConnection>
5656
implements LoadBalancerFactory<ResolvedAddress, C> {
5757

@@ -167,10 +167,9 @@ private <T extends C> LoadBalancer<T> buildDefaultLoadBalancerFactory(
167167
*
168168
* @param <ResolvedAddress> The resolved address type.
169169
* @param <C> The type of connection.
170-
* @deprecated this class will be made package-private in the future, rely on the
171-
* {@link RoundRobinLoadBalancerBuilder} instead.
170+
* @deprecated rely on the {@link LoadBalancers#builder(String)} instead.
172171
*/
173-
@Deprecated // FIXME: 0.43 - make package private
172+
@Deprecated // FIXME: 0.43 - Remove in favor of the DefaultLoadBalancer types
174173
public static final class Builder<ResolvedAddress, C extends LoadBalancedConnection>
175174
implements RoundRobinLoadBalancerBuilder<ResolvedAddress, C> {
176175
private final String id;
@@ -186,9 +185,9 @@ public static final class Builder<ResolvedAddress, C extends LoadBalancedConnect
186185
/**
187186
* Creates a new instance with default settings.
188187
*
189-
* @deprecated use {@link RoundRobinLoadBalancers#builder(String)} instead.
188+
* @deprecated use {@link LoadBalancers#builder(String)} instead.
190189
*/
191-
@Deprecated // FIXME: 0.43 - remove deprecated constructor
190+
@Deprecated
192191
public Builder() {
193192
this("undefined");
194193
}

servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancers.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626

2727
/**
2828
* A factory to create {@link RoundRobinLoadBalancer RoundRobinLoadBalancers}.
29+
* @deprecated use {@link LoadBalancers} instead.
2930
*/
30-
public final class RoundRobinLoadBalancers {
31+
@Deprecated
32+
public final class RoundRobinLoadBalancers { // FIXME: 0.43 - remove deprecated class
3133
private static final Logger LOGGER = LoggerFactory.getLogger(RoundRobinLoadBalancers.class);
3234

3335
private static final List<RoundRobinLoadBalancerBuilderProvider> PROVIDERS;
@@ -59,8 +61,10 @@ RoundRobinLoadBalancerBuilder<ResolvedAddress, C> applyProviders(
5961
* @param <ResolvedAddress> The resolved address type.
6062
* @param <C> The type of connection.
6163
* @return a new {@link RoundRobinLoadBalancerBuilder}.
64+
* @deprecated use {#{@link LoadBalancers}} constructors instead.
6265
*/
6366
@SuppressWarnings("deprecation")
67+
@Deprecated
6468
public static <ResolvedAddress, C extends LoadBalancedConnection> RoundRobinLoadBalancerBuilder<ResolvedAddress, C>
6569
builder(final String id) {
6670
return applyProviders(id, new RoundRobinLoadBalancerFactory.Builder<>(id));

0 commit comments

Comments
 (0)