dsmiley commented on a change in pull request #1770:
URL: https://github.com/apache/lucene-solr/pull/1770#discussion_r486536304



##########
File path: solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java
##########
@@ -260,18 +260,13 @@ public final T process(SolrClient client) throws 
SolrServerException, IOExceptio
   public final CompletableFuture<T> processAsynchronously(SolrClient client, 
String collection) {
     final long startNanos = System.nanoTime();
     final CompletableFuture<NamedList<Object>> internalFuture = 
client.requestAsync(this, collection);
-    final CompletableFuture<T> apiFuture = new CompletableFuture<>();
-
-    internalFuture.whenComplete((result, error) -> {
-      if (!internalFuture.isCompletedExceptionally()) {
-        T res = createResponse(client);
-        res.setResponse(result);
-        long endNanos = System.nanoTime();
-        res.setElapsedTime(TimeUnit.NANOSECONDS.toMillis(endNanos - 
startNanos));
-        apiFuture.complete(res);
-      } else {
-        apiFuture.completeExceptionally(error);
-      }
+
+    final CompletableFuture<T> apiFuture = internalFuture.thenApply((result) 
-> {

Review comment:
       What if internalFuture completes exceptionally?




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

Reply via email to