Skip to content

Commit

Permalink
loadbalancer: deprecate RoundRobinLoadBalancer types (#3149)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bryce-anderson authored Dec 20, 2024
1 parent 441c2bc commit 6fc7987
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
*
* @param <ResolvedAddress> The resolved address type.
* @param <C> The type of connection.
* @deprecated use {@link DelegatingLoadBalancerBuilder} instead.
*/
@Deprecated // FIXME: 0.43 - Remove in favor of the DefaultLoadBalancer types
public class DelegatingRoundRobinLoadBalancerBuilder<ResolvedAddress, C extends LoadBalancedConnection>
implements RoundRobinLoadBalancerBuilder<ResolvedAddress, C> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
* @param <ResolvedAddress> The resolved address type.
* @param <C> The type of connection.
*/
// FIXME: 0.43 - remove deprecated class
final class RoundRobinLoadBalancer<ResolvedAddress, C extends LoadBalancedConnection>
implements TestableLoadBalancer<ResolvedAddress, C> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@
* @param <ResolvedAddress> The resolved address type.
* @param <C> The type of connection.
* @see RoundRobinLoadBalancers
* @deprecated use {@link LoadBalancerBuilder} interfaces instead.
*/
// FIXME: 0.43 - remove deprecated interface
@Deprecated
public interface RoundRobinLoadBalancerBuilder<ResolvedAddress, C extends LoadBalancedConnection> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
*
* @param <ResolvedAddress> The resolved address type.
* @param <C> The type of connection.
* @deprecated this class will be made package-private in the future, use {@link RoundRobinLoadBalancers} to create
* @deprecated use {@link LoadBalancers} to create {@link LoadBalancerFactory} instances.
* {@link RoundRobinLoadBalancerBuilder}.
*/
@Deprecated // FIXME: 0.43 - make package private
@Deprecated // FIXME: 0.43 - remove in favor of DefaultLoadBalancer types.
public final class RoundRobinLoadBalancerFactory<ResolvedAddress, C extends LoadBalancedConnection>
implements LoadBalancerFactory<ResolvedAddress, C> {

Expand Down Expand Up @@ -167,10 +167,9 @@ private <T extends C> LoadBalancer<T> buildDefaultLoadBalancerFactory(
*
* @param <ResolvedAddress> The resolved address type.
* @param <C> The type of connection.
* @deprecated this class will be made package-private in the future, rely on the
* {@link RoundRobinLoadBalancerBuilder} instead.
* @deprecated rely on the {@link LoadBalancers#builder(String)} instead.
*/
@Deprecated // FIXME: 0.43 - make package private
@Deprecated // FIXME: 0.43 - Remove in favor of the DefaultLoadBalancer types
public static final class Builder<ResolvedAddress, C extends LoadBalancedConnection>
implements RoundRobinLoadBalancerBuilder<ResolvedAddress, C> {
private final String id;
Expand All @@ -186,9 +185,9 @@ public static final class Builder<ResolvedAddress, C extends LoadBalancedConnect
/**
* Creates a new instance with default settings.
*
* @deprecated use {@link RoundRobinLoadBalancers#builder(String)} instead.
* @deprecated use {@link LoadBalancers#builder(String)} instead.
*/
@Deprecated // FIXME: 0.43 - remove deprecated constructor
@Deprecated
public Builder() {
this("undefined");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<RoundRobinLoadBalancerBuilderProvider> PROVIDERS;
Expand Down Expand Up @@ -59,8 +61,10 @@ RoundRobinLoadBalancerBuilder<ResolvedAddress, C> applyProviders(
* @param <ResolvedAddress> The resolved address type.
* @param <C> The type of connection.
* @return a new {@link RoundRobinLoadBalancerBuilder}.
* @deprecated use {#{@link LoadBalancers}} constructors instead.
*/
@SuppressWarnings("deprecation")
@Deprecated
public static <ResolvedAddress, C extends LoadBalancedConnection> RoundRobinLoadBalancerBuilder<ResolvedAddress, C>
builder(final String id) {
return applyProviders(id, new RoundRobinLoadBalancerFactory.Builder<>(id));
Expand Down

0 comments on commit 6fc7987

Please sign in to comment.