diff --git a/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/DefaultLoadBalancerBuilder.java b/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/DefaultLoadBalancerBuilder.java index e17e76d357..d7612ed3b4 100644 --- a/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/DefaultLoadBalancerBuilder.java +++ b/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/DefaultLoadBalancerBuilder.java @@ -56,12 +56,6 @@ public LoadBalancerBuilder loadBalancingPolicy( return this; } - @Override - public LoadBalancerBuilder loadBalancerObserver( - @Nullable LoadBalancerObserver loadBalancerObserver) { - return loadBalancerObserver(loadBalancerObserver == null ? null : ignored -> loadBalancerObserver); - } - @Override public LoadBalancerBuilder loadBalancerObserver( @Nullable LoadBalancerObserverFactory loadBalancerObserverFactory) { diff --git a/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/DelegatingLoadBalancerBuilder.java b/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/DelegatingLoadBalancerBuilder.java index 5d1785ac17..9c03314021 100644 --- a/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/DelegatingLoadBalancerBuilder.java +++ b/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/DelegatingLoadBalancerBuilder.java @@ -59,13 +59,6 @@ public LoadBalancerBuilder loadBalancingPolicy( return this; } - @Override - public LoadBalancerBuilder loadBalancerObserver( - @Nullable LoadBalancerObserver loadBalancerObserver) { - delegate = delegate.loadBalancerObserver(loadBalancerObserver); - return this; - } - @Override public LoadBalancerBuilder loadBalancerObserver( @Nullable LoadBalancerObserverFactory loadBalancerObserverFactory) { diff --git a/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancerBuilder.java b/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancerBuilder.java index 3a8a478d99..1613018ea0 100644 --- a/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancerBuilder.java +++ b/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancerBuilder.java @@ -70,27 +70,14 @@ public interface LoadBalancerBuilder loadBalancingPolicy( LoadBalancingPolicy loadBalancingPolicy); - /** - * Set the {@link LoadBalancerObserver} to use with this load balancer. - * @param loadBalancerObserver the {@link LoadBalancerObserver} to use, or {@code null} to not use an observer. - * @return {code this} - * @deprecated use the overload that takes a {@link LoadBalancerObserverFactory} - */ - @Deprecated // TODO: remove deprecated method after 0.42.46 release. - LoadBalancerBuilder loadBalancerObserver(@Nullable LoadBalancerObserver loadBalancerObserver); - /** * Set the {@link LoadBalancerObserverFactory} to use with this load balancer. * @param loadBalancerObserverFactory the {@link LoadBalancerObserverFactory} to use, or {@code null} to not use an * observer. * @return {code this} */ - // TODO: remove the default implementation after 0.42.46 release. - default LoadBalancerBuilder loadBalancerObserver( - @Nullable LoadBalancerObserverFactory loadBalancerObserverFactory) { - return loadBalancerObserver(loadBalancerObserverFactory == null ? null - : loadBalancerObserverFactory.newObserver("")); - } + LoadBalancerBuilder loadBalancerObserver( + @Nullable LoadBalancerObserverFactory loadBalancerObserverFactory); /** * Set the {@link OutlierDetectorConfig} to use with this load balancer. diff --git a/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancerPolicies.java b/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancerPolicies.java deleted file mode 100644 index 980ade1867..0000000000 --- a/servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancerPolicies.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright © 2023 Apple Inc. and the ServiceTalk project authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.servicetalk.loadbalancer; - -/** - * A collections of factories for constructing a {@link LoadBalancingPolicy}. - * @deprecated use {@link LoadBalancingPolicies}. - */ -@Deprecated // TODO: remove after 0.42.46 release. -public final class LoadBalancerPolicies { - - private LoadBalancerPolicies() { - // no instances. - } - - /** - * 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 - * cost of being unable to bias toward better performing hosts and can only leverage the course grained - * healthy/unhealthy status of a host. - * @return a builder for the round-robin {@link LoadBalancingPolicy}. - */ - public static RoundRobinLoadBalancingPolicyBuilder roundRobin() { - return new RoundRobinLoadBalancingPolicyBuilder(); - } - - /** - * Builder for the power of two choices (P2C) {@link LoadBalancingPolicy}. - * Power of Two Choices (P2C) leverages both course grained healthy/unhealthy status of a host plus additional - * fine-grained scoring to prioritize hosts that are both healthy and better performing. See the - * {@link P2CLoadBalancingPolicy} for more details. - * @return a builder for the power of two choices (P2C) {@link LoadBalancingPolicy}. - */ - public static P2CLoadBalancingPolicyBuilder p2c() { - return new P2CLoadBalancingPolicyBuilder(); - } -} diff --git a/servicetalk-loadbalancer-experimental/src/test/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerBuilderAdapter.java b/servicetalk-loadbalancer-experimental/src/test/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerBuilderAdapter.java index 32c933ae56..db20dd3ad8 100644 --- a/servicetalk-loadbalancer-experimental/src/test/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerBuilderAdapter.java +++ b/servicetalk-loadbalancer-experimental/src/test/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancerBuilderAdapter.java @@ -38,7 +38,7 @@ public LoadBalancerBuilder loadBalancingPoli @Override public LoadBalancerBuilder loadBalancerObserver( - @Nullable LoadBalancerObserver loadBalancerObserver) { + @Nullable LoadBalancerObserverFactory loadBalancerObserverFactory) { throw new IllegalStateException("Cannot set a load balancer observer for old round robin"); }