Browse Source

Remove deprecated elements in SC LoadBalancer.

pull/1170/head
Olga Maciaszek-Sharma 2 years ago
parent
commit
5cb7a0d289
  1. 14
      spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/RetryLoadBalancerInterceptor.java
  2. 23
      spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/reactive/ReactorLoadBalancerExchangeFilterFunction.java
  3. 23
      spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/reactive/RetryableLoadBalancerExchangeFilterFunction.java
  4. 10
      spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/blocking/client/BlockingLoadBalancerClient.java
  5. 21
      spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/HealthCheckServiceInstanceListSupplier.java
  6. 11
      spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/HintBasedServiceInstanceListSupplier.java
  7. 14
      spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/LoadBalancerServiceInstanceCookieTransformer.java
  8. 11
      spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/RequestBasedStickySessionServiceInstanceListSupplier.java
  9. 9
      spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/support/LoadBalancerClientFactory.java

14
spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/RetryLoadBalancerInterceptor.java

@ -57,20 +57,6 @@ public class RetryLoadBalancerInterceptor implements ClientHttpRequestIntercepto @@ -57,20 +57,6 @@ public class RetryLoadBalancerInterceptor implements ClientHttpRequestIntercepto
private final ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerFactory;
/**
* @deprecated in favour of
* {@link RetryLoadBalancerInterceptor#RetryLoadBalancerInterceptor(LoadBalancerClient, LoadBalancerRequestFactory, LoadBalancedRetryFactory, ReactiveLoadBalancer.Factory)}
*/
@Deprecated
public RetryLoadBalancerInterceptor(LoadBalancerClient loadBalancer, LoadBalancerProperties properties,
LoadBalancerRequestFactory requestFactory, LoadBalancedRetryFactory lbRetryFactory,
ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerFactory) {
this.loadBalancer = loadBalancer;
this.requestFactory = requestFactory;
this.lbRetryFactory = lbRetryFactory;
this.loadBalancerFactory = loadBalancerFactory;
}
public RetryLoadBalancerInterceptor(LoadBalancerClient loadBalancer, LoadBalancerRequestFactory requestFactory,
LoadBalancedRetryFactory lbRetryFactory,
ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerFactory) {

23
spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/reactive/ReactorLoadBalancerExchangeFilterFunction.java

@ -63,29 +63,6 @@ public class ReactorLoadBalancerExchangeFilterFunction implements LoadBalancedEx @@ -63,29 +63,6 @@ public class ReactorLoadBalancerExchangeFilterFunction implements LoadBalancedEx
private final List<LoadBalancerClientRequestTransformer> transformers;
/**
* @param loadBalancerFactory the loadbalancer factory
* @param properties the properties for SC LoadBalancer
* @deprecated Deprecated in favor of
* {@link #ReactorLoadBalancerExchangeFilterFunction(ReactiveLoadBalancer.Factory, LoadBalancerProperties, List)}.
*/
@Deprecated
public ReactorLoadBalancerExchangeFilterFunction(ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerFactory,
LoadBalancerProperties properties) {
this(loadBalancerFactory, properties, Collections.emptyList());
}
/**
* @deprecated in favour of
* {@link ReactorLoadBalancerExchangeFilterFunction#ReactorLoadBalancerExchangeFilterFunction(ReactiveLoadBalancer.Factory, List)}
*/
@Deprecated
public ReactorLoadBalancerExchangeFilterFunction(ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerFactory,
LoadBalancerProperties properties, List<LoadBalancerClientRequestTransformer> transformers) {
this.loadBalancerFactory = loadBalancerFactory;
this.transformers = transformers;
}
public ReactorLoadBalancerExchangeFilterFunction(ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerFactory,
List<LoadBalancerClientRequestTransformer> transformers) {
this.loadBalancerFactory = loadBalancerFactory;

23
spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/reactive/RetryableLoadBalancerExchangeFilterFunction.java

@ -69,29 +69,6 @@ public class RetryableLoadBalancerExchangeFilterFunction implements LoadBalanced @@ -69,29 +69,6 @@ public class RetryableLoadBalancerExchangeFilterFunction implements LoadBalanced
private final List<LoadBalancerClientRequestTransformer> transformers;
/**
* @deprecated Deprecated in favor of
* {@link #RetryableLoadBalancerExchangeFilterFunction(LoadBalancerRetryPolicy, ReactiveLoadBalancer.Factory, LoadBalancerProperties, List)}.
*/
@Deprecated
public RetryableLoadBalancerExchangeFilterFunction(LoadBalancerRetryPolicy retryPolicy,
ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerFactory, LoadBalancerProperties properties) {
this(retryPolicy, loadBalancerFactory, properties, Collections.emptyList());
}
/**
* @deprecated in favour of
* {@link ReactorLoadBalancerExchangeFilterFunction#ReactorLoadBalancerExchangeFilterFunction(ReactiveLoadBalancer.Factory, List)}
*/
@Deprecated
public RetryableLoadBalancerExchangeFilterFunction(LoadBalancerRetryPolicy retryPolicy,
ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerFactory, LoadBalancerProperties properties,
List<LoadBalancerClientRequestTransformer> transformers) {
this.retryPolicyFactory = s -> retryPolicy;
this.loadBalancerFactory = loadBalancerFactory;
this.transformers = transformers;
}
public RetryableLoadBalancerExchangeFilterFunction(LoadBalancerRetryPolicy.Factory retryPolicyFactory,
ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerFactory,
List<LoadBalancerClientRequestTransformer> transformers) {

10
spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/blocking/client/BlockingLoadBalancerClient.java

@ -61,16 +61,6 @@ public class BlockingLoadBalancerClient implements LoadBalancerClient { @@ -61,16 +61,6 @@ public class BlockingLoadBalancerClient implements LoadBalancerClient {
private final ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerClientFactory;
/**
* @deprecated in favour of
* {@link BlockingLoadBalancerClient#BlockingLoadBalancerClient(ReactiveLoadBalancer.Factory)}
*/
@Deprecated
public BlockingLoadBalancerClient(LoadBalancerClientFactory loadBalancerClientFactory,
LoadBalancerProperties properties) {
this.loadBalancerClientFactory = loadBalancerClientFactory;
}
public BlockingLoadBalancerClient(ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerClientFactory) {
this.loadBalancerClientFactory = loadBalancerClientFactory;
}

21
spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/HealthCheckServiceInstanceListSupplier.java

@ -60,27 +60,6 @@ public class HealthCheckServiceInstanceListSupplier extends DelegatingServiceIns @@ -60,27 +60,6 @@ public class HealthCheckServiceInstanceListSupplier extends DelegatingServiceIns
private final BiFunction<ServiceInstance, String, Mono<Boolean>> aliveFunction;
/**
* @deprecated in favour of
* {@link HealthCheckServiceInstanceListSupplier#HealthCheckServiceInstanceListSupplier(ServiceInstanceListSupplier, ReactiveLoadBalancer.Factory, BiFunction)}
*/
@Deprecated
public HealthCheckServiceInstanceListSupplier(ServiceInstanceListSupplier delegate,
LoadBalancerProperties.HealthCheck healthCheck,
BiFunction<ServiceInstance, String, Mono<Boolean>> aliveFunction) {
super(delegate);
defaultHealthCheckPath = healthCheck.getPath().getOrDefault("default", "/actuator/health");
this.aliveFunction = aliveFunction;
this.healthCheck = healthCheck;
Repeat<Object> aliveInstancesReplayRepeat = Repeat
.onlyIf(repeatContext -> this.healthCheck.getRefetchInstances())
.fixedBackoff(healthCheck.getRefetchInstancesInterval());
Flux<List<ServiceInstance>> aliveInstancesFlux = Flux.defer(delegate).repeatWhen(aliveInstancesReplayRepeat)
.switchMap(serviceInstances -> healthCheckFlux(serviceInstances).map(alive -> List.copyOf(alive)));
aliveInstancesReplay = aliveInstancesFlux.delaySubscription(healthCheck.getInitialDelay()).replay(1)
.refCount(1);
}
public HealthCheckServiceInstanceListSupplier(ServiceInstanceListSupplier delegate,
ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerClientFactory,
BiFunction<ServiceInstance, String, Mono<Boolean>> aliveFunction) {

11
spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/HintBasedServiceInstanceListSupplier.java

@ -41,17 +41,6 @@ public class HintBasedServiceInstanceListSupplier extends DelegatingServiceInsta @@ -41,17 +41,6 @@ public class HintBasedServiceInstanceListSupplier extends DelegatingServiceInsta
private final LoadBalancerProperties properties;
/**
* @deprecated in favour of
* {@link HintBasedServiceInstanceListSupplier#HintBasedServiceInstanceListSupplier(ServiceInstanceListSupplier, ReactiveLoadBalancer.Factory)}
*/
@Deprecated
public HintBasedServiceInstanceListSupplier(ServiceInstanceListSupplier delegate,
LoadBalancerProperties properties) {
super(delegate);
this.properties = properties;
}
public HintBasedServiceInstanceListSupplier(ServiceInstanceListSupplier delegate,
ReactiveLoadBalancer.Factory<ServiceInstance> factory) {
super(delegate);

14
spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/LoadBalancerServiceInstanceCookieTransformer.java

@ -40,17 +40,6 @@ public class LoadBalancerServiceInstanceCookieTransformer implements LoadBalance @@ -40,17 +40,6 @@ public class LoadBalancerServiceInstanceCookieTransformer implements LoadBalance
private ReactiveLoadBalancer.Factory<ServiceInstance> factory;
private LoadBalancerProperties.StickySession stickySessionProperties;
/**
* @deprecated in favour of
* {@link LoadBalancerServiceInstanceCookieTransformer#LoadBalancerServiceInstanceCookieTransformer(ReactiveLoadBalancer.Factory)}
*/
@Deprecated
public LoadBalancerServiceInstanceCookieTransformer(LoadBalancerProperties.StickySession stickySessionProperties) {
this.stickySessionProperties = stickySessionProperties;
}
public LoadBalancerServiceInstanceCookieTransformer(ReactiveLoadBalancer.Factory<ServiceInstance> factory) {
this.factory = factory;
}
@ -61,7 +50,8 @@ public class LoadBalancerServiceInstanceCookieTransformer implements LoadBalance @@ -61,7 +50,8 @@ public class LoadBalancerServiceInstanceCookieTransformer implements LoadBalance
return request;
}
LoadBalancerProperties.StickySession stickySession = factory != null
? factory.getProperties(instance.getServiceId()).getStickySession() : stickySessionProperties;
? factory.getProperties(instance.getServiceId())
.getStickySession() : new LoadBalancerProperties.StickySession();
if (!stickySession.isAddServiceInstanceCookie()) {
return request;
}

11
spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/RequestBasedStickySessionServiceInstanceListSupplier.java

@ -43,17 +43,6 @@ public class RequestBasedStickySessionServiceInstanceListSupplier extends Delega @@ -43,17 +43,6 @@ public class RequestBasedStickySessionServiceInstanceListSupplier extends Delega
private final LoadBalancerProperties properties;
/**
* @deprecated in favour of
* {@link RequestBasedStickySessionServiceInstanceListSupplier#RequestBasedStickySessionServiceInstanceListSupplier(ServiceInstanceListSupplier, ReactiveLoadBalancer.Factory)}
*/
@Deprecated
public RequestBasedStickySessionServiceInstanceListSupplier(ServiceInstanceListSupplier delegate,
LoadBalancerProperties properties) {
super(delegate);
this.properties = properties;
}
public RequestBasedStickySessionServiceInstanceListSupplier(ServiceInstanceListSupplier delegate,
ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerClientFactory) {
super(delegate);

9
spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/support/LoadBalancerClientFactory.java

@ -55,15 +55,6 @@ public class LoadBalancerClientFactory extends NamedContextFactory<LoadBalancerC @@ -55,15 +55,6 @@ public class LoadBalancerClientFactory extends NamedContextFactory<LoadBalancerC
private final LoadBalancerClientsProperties properties;
/**
* @deprecated in favour of
* {@link LoadBalancerClientFactory#LoadBalancerClientFactory(LoadBalancerClientsProperties)}
*/
@Deprecated
public LoadBalancerClientFactory() {
this(null);
}
public LoadBalancerClientFactory(LoadBalancerClientsProperties properties) {
super(LoadBalancerClientConfiguration.class, NAMESPACE, PROPERTY_NAME);
this.properties = properties;

Loading…
Cancel
Save