dsmiley commented on code in PR #2724:
URL: https://github.com/apache/solr/pull/2724#discussion_r1779101220
##########
solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java:
##########
@@ -1225,4 +1228,30 @@ public SolrRequest.SolrClientContext getContext() {
public String getDefaultCollection() {
return defaultCollection;
}
+
+ /**
+ * 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
+ * @return a {@link CompletableFuture} that tracks the progress of the async
request. Supports
+ * cancelling requests via {@link CompletableFuture#cancel(boolean)},
adding callbacks/error
+ * handling using {@link CompletableFuture#whenComplete(BiConsumer)} and
{@link
+ * CompletableFuture#exceptionally(Function)} methods, and other
CompletableFuture
+ * functionality. Will complete exceptionally in case of either an
{@link IOException} or
+ * {@link SolrServerException} during the request. Once completed, the
CompletableFuture will
+ * contain a {@link NamedList} with the response from the server.
+ */
+ public abstract CompletableFuture<NamedList<Object>> requestAsync(
Review Comment:
why not add a default impl throwing UnsupportedOperationException here?
##########
solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java:
##########
@@ -1225,4 +1228,30 @@ public SolrRequest.SolrClientContext getContext() {
public String getDefaultCollection() {
return defaultCollection;
}
+
+ /**
+ * 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
+ * @return a {@link CompletableFuture} that tracks the progress of the async
request. Supports
+ * cancelling requests via {@link CompletableFuture#cancel(boolean)},
adding callbacks/error
+ * handling using {@link CompletableFuture#whenComplete(BiConsumer)} and
{@link
+ * CompletableFuture#exceptionally(Function)} methods, and other
CompletableFuture
+ * functionality. Will complete exceptionally in case of either an
{@link IOException} or
+ * {@link SolrServerException} during the request. Once completed, the
CompletableFuture will
+ * contain a {@link NamedList} with the response from the server.
+ */
+ public abstract CompletableFuture<NamedList<Object>> requestAsync(
+ final SolrRequest<?> request, String collection);
+
+ /**
+ * Execute an asynchronous request against a Solr server using the default
collection.
+ *
+ * @param request the request to execute
+ * @return a {@link CompletableFuture} see {@link #requestAsync(SolrRequest,
String)}.
+ */
+ public CompletableFuture<NamedList<Object>> requestAsync(final
SolrRequest<?> request) {
Review Comment:
should be final
--
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]