Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small improvements of the class RetrayableEurekaHttpClient #1456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class RetryableEurekaHttpClient extends EurekaHttpClientDecorator {

private final String name;
private final EurekaTransportConfig transportConfig;
private final ClusterResolver clusterResolver;
private final ClusterResolver<EurekaEndpoint> clusterResolver;
private final TransportClientFactory clientFactory;
private final ServerStatusEvaluator serverStatusEvaluator;
private final int numberOfRetries;
Expand All @@ -73,7 +73,7 @@ public class RetryableEurekaHttpClient extends EurekaHttpClientDecorator {

public RetryableEurekaHttpClient(String name,
EurekaTransportConfig transportConfig,
ClusterResolver clusterResolver,
ClusterResolver<EurekaEndpoint> clusterResolver,
TransportClientFactory clientFactory,
ServerStatusEvaluator serverStatusEvaluator,
int numberOfRetries) {
Expand Down Expand Up @@ -168,18 +168,16 @@ private List<EurekaEndpoint> getHostCandidates() {
if (threshold > candidateHosts.size()) {
threshold = candidateHosts.size();
}
if (quarantineSet.isEmpty()) {
// no-op
} else if (quarantineSet.size() >= threshold) {

if (quarantineSet.size() >= threshold) {
logger.debug("Clearing quarantined list of size {}", quarantineSet.size());
quarantineSet.clear();
} else {
List<EurekaEndpoint> remainingHosts = new ArrayList<>(candidateHosts.size());
for (EurekaEndpoint endpoint : candidateHosts) {
if (!quarantineSet.contains(endpoint)) {
remainingHosts.add(endpoint);
}
}
candidateHosts.forEach(e -> {
if (!quarantineSet.contains(e))
remainingHosts.add(e);
});
candidateHosts = remainingHosts;
}

Expand Down