Skip to content

fixed IndexOutOfBoundsException in RoundRobinHostHandler #435

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

Merged
merged 1 commit into from
May 9, 2022
Merged
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
@@ -32,7 +32,7 @@
public class RoundRobinHostHandler implements HostHandler {

private final HostResolver resolver;
private int current;
private long current;
private int fails;
private final List<Exception> lastFailExceptions;
private Host currentHost;
@@ -43,7 +43,7 @@ public RoundRobinHostHandler(final HostResolver resolver) {
this.resolver = resolver;
lastFailExceptions = new ArrayList<>();
hosts = resolver.resolve(true, false);
current = 0;
current = 0L;
reset();
}

@@ -59,7 +59,7 @@ public Host get(final HostHandle hostHandle, AccessType accessType) {
throw e;
}

final int index = (current++) % size;
final int index = (int) ((current++) % size);
Host host = hosts.getHostsList().get(index);
if (hostHandle != null) {
final HostDescription hostDescription = hostHandle.getHost();