dsmiley commented on code in PR #3774:
URL: https://github.com/apache/solr/pull/3774#discussion_r2434539376


##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java:
##########
@@ -73,15 +78,22 @@ protected CloudHttp2SolrClient(Builder builder) {
     // locks.
     this.locks = objectList(builder.parallelCacheRefreshesLocks);
 
-    this.lbClient = new 
LBHttp2SolrClient.Builder<Http2SolrClient>(myClient).build();
+    this.lbClient = new LBHttp2SolrClient.Builder<>(myClient).build();
   }
 
-  private Http2SolrClient createOrGetHttpClientFromBuilder(Builder builder) {
+  private HttpSolrClientBase createOrGetHttpClientFromBuilder(Builder builder) 
{
     if (builder.httpClient != null) {
       return builder.httpClient;
     } else if (builder.internalClientBuilder != null) {
       return builder.internalClientBuilder.build();
     } else {
+      try {

Review Comment:
   I think this logic should be done in a static initializer initializing a 
boolean constant.



##########
solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java:
##########
@@ -59,6 +59,10 @@ public class SolrClientNodeStateProvider implements 
NodeStateProvider, MapWriter
   private Map<String, Map> nodeVsTags = new HashMap<>();
 
   public SolrClientNodeStateProvider(CloudHttp2SolrClient solrClient) {
+    if (!(solrClient.getHttpClient() instanceof Http2SolrClient)) {

Review Comment:
   why bother insisting on this?



##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java:
##########
@@ -73,15 +78,22 @@ protected CloudHttp2SolrClient(Builder builder) {
     // locks.
     this.locks = objectList(builder.parallelCacheRefreshesLocks);
 
-    this.lbClient = new 
LBHttp2SolrClient.Builder<Http2SolrClient>(myClient).build();
+    this.lbClient = new LBHttp2SolrClient.Builder<>(myClient).build();
   }
 
-  private Http2SolrClient createOrGetHttpClientFromBuilder(Builder builder) {
+  private HttpSolrClientBase createOrGetHttpClientFromBuilder(Builder builder) 
{
     if (builder.httpClient != null) {
       return builder.httpClient;
     } else if (builder.internalClientBuilder != null) {
       return builder.internalClientBuilder.build();
     } else {
+      try {
+        Class.forName("org.eclipse.jetty.client.HttpClient");
+      } catch (ClassNotFoundException e) {

Review Comment:
   have you tried if this actually works?  You'd need to attempt on some 
_other_ project.  Recently I used the Solr MCP project for a similar test to 
see if excluding Apache HttpClient works.



##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpJdkSolrClient.java:
##########
@@ -379,24 +380,31 @@ protected boolean maybeTryHeadRequest(String url) {
     if (forceHttp11 || url == null || 
url.toLowerCase(Locale.ROOT).startsWith("https://";)) {
       return true;
     }
-    return maybeTryHeadRequestSync(url);
-  }
-
-  protected volatile boolean headRequested; // must be threadsafe
-  private boolean headSucceeded; // must be threadsafe
-
-  private synchronized boolean maybeTryHeadRequestSync(String url) {
-    if (headRequested) {
-      return headSucceeded;
-    }
-
     URI uriNoQueryParams;
     try {
-      uriNoQueryParams = new URI(url);
+      var uriWithParams = new URI(url);
+      var uriNoPQueryParamsStr =
+          uriWithParams.getScheme()
+              + "://"
+              + uriWithParams.getAuthority()
+              + uriWithParams.getPath();
+      uriNoQueryParams = new URI(uriNoPQueryParamsStr);
     } catch (URISyntaxException e) {
       // If the url is invalid, let a subsequent request try again.
       return false;
     }
+    return maybeTryHeadRequestSync(uriNoQueryParams);
+  }
+
+  protected final Map<URI, Boolean> headSucceededByBaseUri =

Review Comment:
   do we really need to differentiate by base URI?  Meaning, in practice, is 
that really a concern?



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