tibrewalpratik17 commented on code in PR #12353:
URL: https://github.com/apache/pinot/pull/12353#discussion_r1482662603


##########
pinot-common/src/main/java/org/apache/pinot/common/utils/RoundRobinURIProvider.java:
##########
@@ -63,4 +78,33 @@ public URI next() {
     _index = (_index + 1) % _uris.length;
     return result;
   }
+
+  public URI[] resolveHostToIPAddresses(URI originalUri)

Review Comment:
   Ah my bad missed this! Updated! 



##########
pinot-common/src/main/java/org/apache/pinot/common/utils/RoundRobinURIProvider.java:
##########
@@ -38,18 +41,30 @@ public class RoundRobinURIProvider {
 
   public RoundRobinURIProvider(URI originalUri)
       throws UnknownHostException, URISyntaxException {
-    String hostName = originalUri.getHost();
-    if (InetAddresses.isInetAddress(hostName)) {
+    this(originalUri, true);
+  }
+
+  public RoundRobinURIProvider(URI originalUri, boolean resolveHost)
+      throws UnknownHostException, URISyntaxException {
+    if (resolveHost) {
+      _uris = resolveHostToIPAddresses(originalUri);
+    } else {
       _uris = new URI[]{originalUri};
+    }
+    _index = new Random().nextInt(_uris.length);
+  }
+
+  public RoundRobinURIProvider(List<URI> originalUris)
+      throws UnknownHostException, URISyntaxException {
+    this(originalUris, true);
+  }
+
+  public RoundRobinURIProvider(List<URI> originalUris, boolean resolveHost)

Review Comment:
   Updated to just 1 ctor.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to