rishisankar commented on a change in pull request #1770:
URL: https://github.com/apache/lucene-solr/pull/1770#discussion_r474810544
##########
File path:
solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java
##########
@@ -853,6 +858,18 @@ public RouteException(ErrorCode errorCode,
NamedList<Throwable> throwables, Map<
@Override
public NamedList<Object> request(@SuppressWarnings({"rawtypes"})SolrRequest
request, String collection) throws SolrServerException, IOException {
+ // synchronous requests should return an already completed future
+ return getNowOrException(makeRequest(request, collection, false));
+ }
+
+ CompletableFuture<NamedList<Object>> makeRequest(SolrRequest<?> request,
+ String collection,
+ boolean isAsyncRequest)
throws SolrServerException, IOException {
+ if (isAsyncRequest && !(getLbClient() instanceof LBHttp2SolrClient)) {
+ log.warn("Asynchronous requests require HTTP/2 SolrJ client, defaulting
to synchronous request.");
+ isAsyncRequest = false;
Review comment:
The reason I included this check was because I later cast
`(LBHttp2SolrClient)getLbClient()` (in sendRequest) - so even without this
check, custom LB client implementations wouldn't work unless they subclass
LBHttp2SolrClient. Perhaps another approach is to add an abstract asyncRequest
method to LBSolrClient (which both `LBHttpSolrClient` and `LBHttp2SolrClient`
extend) and just call that instead - and throw an
`UnsupportedOperationException` in the case of the HTTP/1 client for now. What
do you think?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]