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


##########
pinot-common/src/main/java/org/apache/pinot/common/utils/RoundRobinURIProvider.java:
##########
@@ -23,44 +23,66 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Random;
 import org.apache.http.client.utils.URIBuilder;
 
 
 /**
- * RoundRobinURIProvider accept a URI, try to resolve it into multiple URIs 
with IP address, and return a IP address URI
- * in a Round Robin way.
+ * RoundRobinURIProvider accept a list of URIs and whether to resolve them 
into multiple URIs with IP address.
+ * If resolveHost = true, it returns a IP address URI in a Round Robin way.
+ * If resolveHost = false, then it returns a URI in a Round Robin way.
  */
 public class RoundRobinURIProvider {
 
-  private final URI[] _uris;
+  private final List<URI> _uris;
   private int _index;
 
-  public RoundRobinURIProvider(URI originalUri)
+  public RoundRobinURIProvider(List<URI> originalUris, boolean resolveHost)
       throws UnknownHostException, URISyntaxException {
+    if (resolveHost) {
+      _uris = resolveHostsToIPAddresses(originalUris);
+    } else {
+      _uris = originalUris;

Review Comment:
   Recommend creating a copy of `originalUris` since callers could modify the 
passed arg



-- 
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