return ImmutableSet.copyOf(_badEndPoints.keySet());
}
@Override
public HealthCheckResults checkForHealthyEndPoint() {
DefaultHealthCheckResults aggregate = new DefaultHealthCheckResults();
Iterable<ServiceEndPoint> allEndPoints = getAllEndPoints();
if (Iterables.isEmpty(allEndPoints)) {
// There were no end points
return aggregate;
}
Iterable<ServiceEndPoint> validEndPoints = getValidEndPoints(allEndPoints);
if (Iterables.isEmpty(validEndPoints)) {
// There were no valid end points
return aggregate;
}
Set<ServiceEndPoint> endPoints = Sets.newHashSet(validEndPoints);
while (!endPoints.isEmpty()) {
// Prefer end points in the order the load balancer recommends.
ServiceEndPoint endPoint = chooseEndPoint(endPoints, PartitionContextBuilder.empty());
if (endPoint == null) {
// Load balancer didn't like our end points, so just go sequentially.
endPoint = endPoints.iterator().next();
}
HealthCheckResult result = checkHealth(endPoint);
aggregate.addHealthCheckResult(result);
if (!result.isHealthy()) {
Exception exception = ((FailedHealthCheckResult) result).getException();
if (exception == null || isRetriableException(exception)) {
LOG.debug("Unhealthy end point discovered. End point ID: {}", endPoint.getId());