dsmiley commented on a change in pull request #1688: URL: https://github.com/apache/lucene-solr/pull/1688#discussion_r463644255
########## File path: solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java ########## @@ -113,6 +118,25 @@ protected boolean wasCommError(Throwable rootCause) { return false; } + /** + * Execute an asynchronous request against a Solr server for a given collection + * + * @param request the request to execute + * @param collection the collection to execute the request against + * @param asyncListener the request listener, not null (use a no-op listener instead for async requests with no callback) + * + * @return a {@link Cancellable} allowing you to cancel execution of the async request + * + * @throws IOException If there is a low-level I/O error. + * @throws SolrServerException if there is an error on the server + */ + public Cancellable asyncRequest(@SuppressWarnings({"rawtypes"}) SolrRequest request, Review comment: Some play code: ``` public static void main(String[] args) throws InterruptedException, ExecutionException { CompletableFuture<String> clientCf = new CompletableFuture<>(); final Thread thread = new Thread(() -> { CompletableFuture<String> workCf = clientCf.whenComplete((result, throwable) -> { System.out.println("whenComplete r:" + result + " t:" + throwable); }); try { Thread.sleep(2000); System.out.println("bg: cancelled? " + workCf.isCancelled()); clientCf.complete("Completed-Result"); } catch (InterruptedException e) { System.out.println("bg: Interrupted"); e.printStackTrace(); } }); thread.start(); Thread.sleep(1000); boolean cancelRsp = clientCf.cancel(true); System.out.println("client: cancelRsp (was cancelled)="+cancelRsp); if (!cancelRsp) { System.out.println("client: " + clientCf.get()); } thread.join(); } ``` ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org