Skip to content

Commit 2b30b35

Browse files
committed
Merge branch 'fitzoh-master'
2 parents 84358e1 + de0a14b commit 2b30b35

File tree

9 files changed

+6
-386
lines changed

9 files changed

+6
-386
lines changed

spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/annotation/LoadBalancerClientConfiguration.java

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.cloud.loadbalancer.annotation;
1818

19-
import org.springframework.beans.factory.ObjectProvider;
2019
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
2120
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
2221
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -26,16 +25,11 @@
2625
import org.springframework.cloud.client.ServiceInstance;
2726
import org.springframework.cloud.client.discovery.DiscoveryClient;
2827
import org.springframework.cloud.client.discovery.ReactiveDiscoveryClient;
29-
import org.springframework.cloud.loadbalancer.cache.LoadBalancerCacheManager;
30-
import org.springframework.cloud.loadbalancer.core.CachingServiceInstanceSupplier;
31-
import org.springframework.cloud.loadbalancer.core.DiscoveryClientServiceInstanceSupplier;
3228
import org.springframework.cloud.loadbalancer.core.ReactorLoadBalancer;
3329
import org.springframework.cloud.loadbalancer.core.RoundRobinLoadBalancer;
3430
import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier;
3531
import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSuppliers;
36-
import org.springframework.cloud.loadbalancer.core.ServiceInstanceSupplier;
3732
import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
38-
import org.springframework.context.ApplicationContext;
3933
import org.springframework.context.ConfigurableApplicationContext;
4034
import org.springframework.context.annotation.Bean;
4135
import org.springframework.context.annotation.Configuration;
@@ -101,23 +95,6 @@ public ServiceInstanceListSupplier healthCheckDiscoveryClientServiceInstanceList
10195
.withHealthChecks().withCaching().build(context);
10296
}
10397

104-
@Bean
105-
@ConditionalOnBean(ReactiveDiscoveryClient.class)
106-
@ConditionalOnMissingBean
107-
public ServiceInstanceSupplier discoveryClientServiceInstanceSupplier(
108-
ReactiveDiscoveryClient discoveryClient, Environment env,
109-
ApplicationContext context) {
110-
DiscoveryClientServiceInstanceSupplier delegate = new DiscoveryClientServiceInstanceSupplier(
111-
discoveryClient, env);
112-
ObjectProvider<LoadBalancerCacheManager> cacheManagerProvider = context
113-
.getBeanProvider(LoadBalancerCacheManager.class);
114-
if (cacheManagerProvider.getIfAvailable() != null) {
115-
return new CachingServiceInstanceSupplier(delegate,
116-
cacheManagerProvider.getIfAvailable());
117-
}
118-
return delegate;
119-
}
120-
12198
}
12299

123100
@Configuration(proxyBeanMethods = false)
@@ -158,23 +135,6 @@ public ServiceInstanceListSupplier healthCheckDiscoveryClientServiceInstanceList
158135
.withHealthChecks().withCaching().build(context);
159136
}
160137

161-
@Bean
162-
@ConditionalOnBean(DiscoveryClient.class)
163-
@ConditionalOnMissingBean
164-
public ServiceInstanceSupplier discoveryClientServiceInstanceSupplier(
165-
DiscoveryClient discoveryClient, Environment env,
166-
ApplicationContext context) {
167-
DiscoveryClientServiceInstanceSupplier delegate = new DiscoveryClientServiceInstanceSupplier(
168-
discoveryClient, env);
169-
ObjectProvider<LoadBalancerCacheManager> cacheManagerProvider = context
170-
.getBeanProvider(LoadBalancerCacheManager.class);
171-
if (cacheManagerProvider.getIfAvailable() != null) {
172-
return new CachingServiceInstanceSupplier(delegate,
173-
cacheManagerProvider.getIfAvailable());
174-
}
175-
return delegate;
176-
}
177-
178138
}
179139

180140
}

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

Lines changed: 0 additions & 77 deletions
This file was deleted.

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

Lines changed: 0 additions & 64 deletions
This file was deleted.

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

Lines changed: 0 additions & 42 deletions
This file was deleted.

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

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,10 @@ public class RoundRobinLoadBalancer implements ReactorServiceInstanceLoadBalance
4343

4444
private final AtomicInteger position;
4545

46-
@Deprecated
47-
private ObjectProvider<ServiceInstanceSupplier> serviceInstanceSupplier;
48-
4946
private ObjectProvider<ServiceInstanceListSupplier> serviceInstanceListSupplierProvider;
5047

5148
private final String serviceId;
5249

53-
/**
54-
* @param serviceId id of the service for which to choose an instance
55-
* @param serviceInstanceSupplier a provider of {@link ServiceInstanceSupplier} that
56-
* will be used to get available instances
57-
* @deprecated Use {@link #RoundRobinLoadBalancer(ObjectProvider, String)}} instead.
58-
*/
59-
@Deprecated
60-
public RoundRobinLoadBalancer(String serviceId,
61-
ObjectProvider<ServiceInstanceSupplier> serviceInstanceSupplier) {
62-
this(serviceId, serviceInstanceSupplier, new Random().nextInt(1000));
63-
}
64-
6550
/**
6651
* @param serviceInstanceListSupplierProvider a provider of
6752
* {@link ServiceInstanceListSupplier} that will be used to get available instances
@@ -87,39 +72,15 @@ public RoundRobinLoadBalancer(
8772
this.position = new AtomicInteger(seedPosition);
8873
}
8974

90-
/**
91-
* @param serviceId id of the service for which to choose an instance
92-
* @param serviceInstanceSupplier a provider of {@link ServiceInstanceSupplier} that
93-
* will be used to get available instances
94-
* @param seedPosition Round Robin element position marker
95-
* @deprecated Use {@link #RoundRobinLoadBalancer(ObjectProvider, String, int)}}
96-
* instead.
97-
*/
98-
@Deprecated
99-
public RoundRobinLoadBalancer(String serviceId,
100-
ObjectProvider<ServiceInstanceSupplier> serviceInstanceSupplier,
101-
int seedPosition) {
102-
this.serviceId = serviceId;
103-
this.serviceInstanceSupplier = serviceInstanceSupplier;
104-
this.position = new AtomicInteger(seedPosition);
105-
}
106-
10775
@SuppressWarnings("rawtypes")
10876
@Override
10977
// see original
11078
// https://github.com/Netflix/ocelli/blob/master/ocelli-core/
11179
// src/main/java/netflix/ocelli/loadbalancer/RoundRobinLoadBalancer.java
11280
public Mono<Response<ServiceInstance>> choose(Request request) {
113-
// TODO: move supplier to Request?
114-
// Temporary conditional logic till deprecated members are removed.
115-
if (serviceInstanceListSupplierProvider != null) {
116-
ServiceInstanceListSupplier supplier = serviceInstanceListSupplierProvider
117-
.getIfAvailable(NoopServiceInstanceListSupplier::new);
118-
return supplier.get().next().map(this::getInstanceResponse);
119-
}
120-
ServiceInstanceSupplier supplier = this.serviceInstanceSupplier
121-
.getIfAvailable(NoopServiceInstanceSupplier::new);
122-
return supplier.get().collectList().map(this::getInstanceResponse);
81+
ServiceInstanceListSupplier supplier = serviceInstanceListSupplierProvider
82+
.getIfAvailable(NoopServiceInstanceListSupplier::new);
83+
return supplier.get().next().map(this::getInstanceResponse);
12384
}
12485

12586
private Response<ServiceInstance> getInstanceResponse(

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

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)