Skip to content

Commit ff9aa6c

Browse files
authored
fixed IndexOutOfBoundsException in RoundRobinHostHandler (#435)
1 parent 8c2e7fc commit ff9aa6c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/com/arangodb/internal/net/RoundRobinHostHandler.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
public class RoundRobinHostHandler implements HostHandler {
3333

3434
private final HostResolver resolver;
35-
private int current;
35+
private long current;
3636
private int fails;
3737
private final List<Exception> lastFailExceptions;
3838
private Host currentHost;
@@ -43,7 +43,7 @@ public RoundRobinHostHandler(final HostResolver resolver) {
4343
this.resolver = resolver;
4444
lastFailExceptions = new ArrayList<>();
4545
hosts = resolver.resolve(true, false);
46-
current = 0;
46+
current = 0L;
4747
reset();
4848
}
4949

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

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

0 commit comments

Comments
 (0)