vvova15 commented on code in PR #4260:
URL: https://github.com/apache/solr/pull/4260#discussion_r3049475696


##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java:
##########
@@ -77,29 +77,37 @@ public void setDefaultZKHost(String zkHost) {
     }
   }
 
-  public synchronized CloudSolrClient getCloudSolrClient(String zkHost) {
+  public synchronized CloudSolrClient getCloudSolrClient(String 
connectionString) {
     ensureOpen();
-    Objects.requireNonNull(zkHost, "ZooKeeper host cannot be null!");
-    if (solrClients.containsKey(zkHost)) {
-      return (CloudSolrClient) solrClients.get(zkHost);
+    Objects.requireNonNull(connectionString, "Connection string cannot be 
null!");
+    if (solrClients.containsKey(connectionString)) {
+      return (CloudSolrClient) solrClients.get(connectionString);
     }
     // Can only use ZK ACLs if there is a default ZK Host, and the given ZK 
host contains that
     // default.
     // Basically the ZK ACLs are assumed to be only used for the default ZK 
host,
     // thus we should only provide the ACLs to that Zookeeper instance.
-    String zkHostNoChroot = zkHost.split("/")[0];
-    boolean canUseACLs =
-        
Optional.ofNullable(defaultZkHost.get()).map(zkHostNoChroot::equals).orElse(false);
+    boolean canUseACLs = false;
+    CloudSolrClient.CloudSolrClientConnection cloudClientConnection =
+        CloudSolrClient.CloudSolrClientConnection.parse(connectionString);
+    if (cloudClientConnection.isZk()) {
+      String chroot = cloudClientConnection.zkChroot();
+      String zkHostNoChroot =
+          StrUtils.isNotBlank(chroot) && connectionString.endsWith(chroot)

Review Comment:
   `cloudClientConnection` should only return a non-empty chroot or null, and 
empty strings or spaces are not expected, is that what you mean?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to