gerlowskija commented on code in PR #2811:
URL: https://github.com/apache/solr/pull/2811#discussion_r1827753327


##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java:
##########
@@ -480,14 +480,35 @@ private static boolean isTimeExceeded(long 
timeAllowedNano, long timeOutTime) {
     return timeAllowedNano > 0 && System.nanoTime() > timeOutTime;
   }
 
+  private NamedList<Object> doMakeRequest(Endpoint endpoint, SolrRequest<?> 
solrRequest)
+      throws SolrServerException, IOException {
+    final var solrClient = getClient(endpoint);
+    return doMakeRequest(solrClient, endpoint.getBaseUrl(), 
endpoint.getCore(), solrRequest);
+  }
+
+  // TODO This special casing can be removed if either: (1) SOLR-16367 is 
completed, or (2)
+  // LBHttp2SolrClient.getClient() is modified to return a client already 
pointed at the correct URL
+  private NamedList<Object> doMakeRequest(
+      SolrClient solrClient, String baseUrl, String collection, SolrRequest<?> 
solrRequest)
+      throws SolrServerException, IOException {
+    // Some implementations of LBSolrClient.getClient(...) return a 
Http2SolrClient that may not be
+    // pointed at the desired URL (or any URL for that matter).  We special 
case that here to ensure
+    // the appropriate URL is provided.
+    if (solrClient instanceof Http2SolrClient) {
+      final var httpSolrClient = (Http2SolrClient) solrClient;
+      return httpSolrClient.requestWithBaseUrl(baseUrl, (c) -> 
c.request(solrRequest, collection));
+    }
+
+    return solrClient.request(solrRequest, collection);

Review Comment:
   Agreed, but IMO that probably deserves its own ticket.
   
   Switching the Jetty LB client to work this way would probably let us 
reuse/share some of the client-management code from the Apache LB 
client...which is great!...but it'd also turn things into a slightly larger 
refactor than I want to tackle here.
   
   If we're agreed on this approach I can create a ticket for that work and 
update the TODO comment here to say essentially: "rip this out when tackling 
SOLR-12345"?



-- 
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: issues-unsubscr...@solr.apache.org

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


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

Reply via email to