File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
core/src/main/java/com/datastax/oss/driver/internal/core/metadata Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 2626import java .util .Arrays ;
2727import java .util .Comparator ;
2828import java .util .Objects ;
29- import java .util .concurrent .atomic .AtomicLong ;
29+ import java .util .concurrent .atomic .AtomicInteger ;
3030
3131public class SniEndPoint implements EndPoint {
32- private static final AtomicLong OFFSET = new AtomicLong ();
32+ private static final AtomicInteger OFFSET = new AtomicInteger ();
3333
3434 private final InetSocketAddress proxyAddress ;
3535 private final String serverName ;
@@ -64,7 +64,10 @@ public InetSocketAddress resolve() {
6464 // The order of the returned address is unspecified. Sort by IP to make sure we get a true
6565 // round-robin
6666 Arrays .sort (aRecords , IP_COMPARATOR );
67- int index = (aRecords .length == 1 ) ? 0 : (int ) OFFSET .getAndIncrement () % aRecords .length ;
67+ int index =
68+ (aRecords .length == 1 )
69+ ? 0
70+ : OFFSET .getAndUpdate (x -> x == Integer .MAX_VALUE ? 0 : x + 1 ) % aRecords .length ;
6871 return new InetSocketAddress (aRecords [index ], proxyAddress .getPort ());
6972 } catch (UnknownHostException e ) {
7073 throw new IllegalArgumentException (
You can’t perform that action at this time.
0 commit comments