use of org.springframework.data.elasticsearch.client.NoReachableHostException in project spring-data-elasticsearch by spring-projects.
the class SingleNodeHostProvider method lookupActiveHost.
/*
* (non-Javadoc)
* @see org.springframework.data.elasticsearch.client.reactive.HostProvider#lookupActiveHost(org.springframework.data.elasticsearch.client.reactive.HostProvider.Verification)
*/
@Override
public Mono<InetSocketAddress> lookupActiveHost(Verification verification) {
if (Verification.LAZY.equals(verification) && state.isOnline()) {
return Mono.just(endpoint);
}
return clusterInfo().handle((information, sink) -> {
ElasticsearchHost host = information.getNodes().iterator().next();
if (host.isOnline()) {
sink.next(host.getEndpoint());
return;
}
sink.error(new NoReachableHostException(Collections.singleton(host)));
});
}
Aggregations