Browse Source

Bumping versions

pull/1255/head
buildmaster 1 year ago
parent
commit
e47d5e5f88
  1. 14
      spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java

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

@ -145,7 +145,7 @@ public final class ServiceInstanceListSupplierBuilder { @@ -145,7 +145,7 @@ public final class ServiceInstanceListSupplierBuilder {
public ServiceInstanceListSupplierBuilder withHealthChecks() {
DelegateCreator creator = (context, delegate) -> {
ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerClientFactory = context
.getBean(LoadBalancerClientFactory.class);
.getBean(LoadBalancerClientFactory.class);
WebClient.Builder webClient = context.getBean(WebClient.Builder.class);
return healthCheckServiceInstanceListSupplier(webClient.build(), delegate, loadBalancerClientFactory);
};
@ -268,7 +268,7 @@ public final class ServiceInstanceListSupplierBuilder { @@ -268,7 +268,7 @@ public final class ServiceInstanceListSupplierBuilder {
}
this.cachingCreator = (context, delegate) -> {
ObjectProvider<LoadBalancerCacheManager> cacheManagerProvider = context
.getBeanProvider(LoadBalancerCacheManager.class);
.getBeanProvider(LoadBalancerCacheManager.class);
if (cacheManagerProvider.getIfAvailable() != null) {
return new CachingServiceInstanceListSupplier(delegate, cacheManagerProvider.getIfAvailable());
}
@ -334,7 +334,8 @@ public final class ServiceInstanceListSupplierBuilder { @@ -334,7 +334,8 @@ public final class ServiceInstanceListSupplierBuilder {
ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerClientFactory) {
return new HealthCheckServiceInstanceListSupplier(delegate, loadBalancerClientFactory,
(serviceInstance, healthCheckPath) -> webClient.get()
.uri(UriComponentsBuilder.fromUriString(getUri(serviceInstance, healthCheckPath)).build().toUri())
.uri(UriComponentsBuilder.fromUriString(getUri(serviceInstance, healthCheckPath)).build()
.toUri())
.exchange().flatMap(clientResponse -> clientResponse.releaseBody()
.thenReturn(HttpStatus.OK.equals(clientResponse.statusCode()))));
}
@ -344,12 +345,11 @@ public final class ServiceInstanceListSupplierBuilder { @@ -344,12 +345,11 @@ public final class ServiceInstanceListSupplierBuilder {
ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerClientFactory) {
return new HealthCheckServiceInstanceListSupplier(delegate, loadBalancerClientFactory,
(serviceInstance, healthCheckPath) -> Mono.defer(() -> {
URI uri = UriComponentsBuilder.fromUriString(getUri(serviceInstance, healthCheckPath))
.build()
.toUri();
URI uri = UriComponentsBuilder.fromUriString(getUri(serviceInstance, healthCheckPath)).build()
.toUri();
try {
return Mono
.just(HttpStatus.OK.equals(restTemplate.getForEntity(uri, Void.class).getStatusCode()));
.just(HttpStatus.OK.equals(restTemplate.getForEntity(uri, Void.class).getStatusCode()));
}
catch (Exception ignored) {
return Mono.just(false);

Loading…
Cancel
Save