SOLR-14763 SolrJ Async - remove deprecated apis from Solr10/main (#2407)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 067eef0..6638557 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -59,6 +59,10 @@
 * SOLR-12089: Remove deprecated `breakSugestionTieBreaker` parameter in favor of `breakSuggestionTieBreaker`
   in WordBreakSolrSpellChecker (Andrey Bozhko via Eric Pugh)
 
+* SOLR-14763: Remove deprecated asynchronous request methods from `Http2SolrClient`, `HttpJdkSolrClient` and `LBHttp2SolrClient`
+  in favor of the new CompletableFuture based methods.  Remove the related deprecated interfaces `AsyncListener` and ``Cancellable`
+  (James Dyer)
+
 Dependency Upgrades
 ---------------------
 (No changes)
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
index 549bb45..40fd27b 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
@@ -47,8 +47,6 @@
 import org.apache.solr.client.solrj.impl.HttpListenerFactory.RequestResponseListener;
 import org.apache.solr.client.solrj.request.RequestWriter;
 import org.apache.solr.client.solrj.request.UpdateRequest;
-import org.apache.solr.client.solrj.util.AsyncListener;
-import org.apache.solr.client.solrj.util.Cancellable;
 import org.apache.solr.client.solrj.util.ClientUtils;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.params.SolrParams;
@@ -418,26 +416,6 @@
   }
 
   @Override
-  public Cancellable asyncRequest(
-      SolrRequest<?> solrRequest,
-      String collection,
-      AsyncListener<NamedList<Object>> asyncListener) {
-
-    asyncListener.onStart();
-    CompletableFuture<NamedList<Object>> cf =
-        requestAsync(solrRequest, collection)
-            .whenComplete(
-                (nl, t) -> {
-                  if (t != null) {
-                    asyncListener.onFailure(t);
-                  } else {
-                    asyncListener.onSuccess(nl);
-                  }
-                });
-    return () -> cf.cancel(true);
-  }
-
-  @Override
   public CompletableFuture<NamedList<Object>> requestAsync(
       final SolrRequest<?> solrRequest, String collection) {
     if (ClientUtils.shouldApplyDefaultCollection(collection, solrRequest)) {
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpJdkSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpJdkSolrClient.java
index 96366d0..034e16a 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpJdkSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpJdkSolrClient.java
@@ -52,8 +52,6 @@
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.request.QueryRequest;
 import org.apache.solr.client.solrj.request.RequestWriter;
-import org.apache.solr.client.solrj.util.AsyncListener;
-import org.apache.solr.client.solrj.util.Cancellable;
 import org.apache.solr.client.solrj.util.ClientUtils;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.ModifiableSolrParams;
@@ -137,26 +135,6 @@
   }
 
   @Override
-  public Cancellable asyncRequest(
-      SolrRequest<?> solrRequest,
-      String collection,
-      AsyncListener<NamedList<Object>> asyncListener) {
-    asyncListener.onStart();
-    CompletableFuture<NamedList<Object>> cf =
-        requestAsync(solrRequest, collection)
-            .whenComplete(
-                (nl, t) -> {
-                  if (t != null) {
-                    asyncListener.onFailure(t);
-                  } else {
-                    asyncListener.onSuccess(nl);
-                  }
-                });
-
-    return new HttpSolrClientCancellable(cf);
-  }
-
-  @Override
   public CompletableFuture<NamedList<Object>> requestAsync(
       final SolrRequest<?> solrRequest, String collection) {
     try {
@@ -539,23 +517,6 @@
         .collect(Collectors.joining(", "));
   }
 
-  protected static class HttpSolrClientCancellable implements Cancellable {
-    private final CompletableFuture<NamedList<Object>> response;
-
-    protected HttpSolrClientCancellable(CompletableFuture<NamedList<Object>> response) {
-      this.response = response;
-    }
-
-    @Override
-    public void cancel() {
-      response.cancel(true);
-    }
-
-    protected CompletableFuture<NamedList<Object>> getResponse() {
-      return response;
-    }
-  }
-
   public static class Builder
       extends HttpSolrClientBuilderBase<HttpJdkSolrClient.Builder, HttpJdkSolrClient> {
 
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClientBase.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClientBase.java
index 95e448d..56df7ca 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClientBase.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClientBase.java
@@ -42,8 +42,6 @@
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.request.RequestWriter;
 import org.apache.solr.client.solrj.request.V2Request;
-import org.apache.solr.client.solrj.util.AsyncListener;
-import org.apache.solr.client.solrj.util.Cancellable;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.ModifiableSolrParams;
@@ -378,20 +376,6 @@
   protected abstract void updateDefaultMimeTypeForParser();
 
   /**
-   * @deprecated use {@link #requestAsync(SolrRequest, String)}.
-   * @param solrRequest the request to perform
-   * @param collection if null the default collection is used
-   * @param asyncListener callers should provide an implementation to handle events: start, success,
-   *     exception
-   * @return Cancellable allowing the caller to attempt cancellation
-   */
-  @Deprecated
-  public abstract Cancellable asyncRequest(
-      SolrRequest<?> solrRequest,
-      String collection,
-      AsyncListener<NamedList<Object>> asyncListener);
-
-  /**
    * Execute an asynchronous request against a Solr server for a given collection.
    *
    * @param request the request to execute
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttp2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttp2SolrClient.java
index ec44802..e6633af 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttp2SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttp2SolrClient.java
@@ -32,8 +32,6 @@
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.request.IsUpdateRequest;
 import org.apache.solr.client.solrj.request.RequestWriter;
-import org.apache.solr.client.solrj.util.AsyncListener;
-import org.apache.solr.client.solrj.util.Cancellable;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.util.NamedList;
 import org.slf4j.MDC;
@@ -127,31 +125,6 @@
   }
 
   /**
-   * Execute an asynchronous request against a one or more hosts for a given collection.
-   *
-   * @param req the wrapped request to perform
-   * @param asyncListener callers should provide an implementation to handle events: start, success,
-   *     exception
-   * @return Cancellable allowing the caller to attempt cancellation
-   * @deprecated Use {@link #requestAsync(Req)}.
-   */
-  @Deprecated
-  public Cancellable asyncReq(Req req, AsyncListener<Rsp> asyncListener) {
-    asyncListener.onStart();
-    CompletableFuture<Rsp> cf =
-        requestAsync(req)
-            .whenComplete(
-                (rsp, t) -> {
-                  if (t != null) {
-                    asyncListener.onFailure(t);
-                  } else {
-                    asyncListener.onSuccess(rsp);
-                  }
-                });
-    return () -> cf.cancel(true);
-  }
-
-  /**
    * Execute an asynchronous request against one or more hosts for a given collection. The passed-in
    * Req object includes a List of Endpoints. This method always begins with the first Endpoint in
    * the list and if unsuccessful tries each in turn until the request is successful. Consequently,
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/util/AsyncListener.java b/solr/solrj/src/java/org/apache/solr/client/solrj/util/AsyncListener.java
deleted file mode 100644
index 690c558..0000000
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/util/AsyncListener.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.solr.client.solrj.util;
-
-/**
- * Listener for async requests
- *
- * @param <T> The result type returned by the {@code onSuccess} method
- * @deprecated Use the async variants that return CompletableFuture.
- */
-@Deprecated
-public interface AsyncListener<T> {
-  /** Callback method invoked before processing the request */
-  default void onStart() {}
-
-  /** Callback method invoked when the request completes successfully */
-  void onSuccess(T t);
-
-  /** Callback method invoked when the request completes in failure */
-  void onFailure(Throwable throwable);
-}
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/util/Cancellable.java b/solr/solrj/src/java/org/apache/solr/client/solrj/util/Cancellable.java
deleted file mode 100644
index 2dff867..0000000
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/util/Cancellable.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.solr.client.solrj.util;
-
-/**
- * The return type for solrJ asynchronous requests, providing a mechanism whereby callers may
- * request cancellation.
- *
- * @deprecated Use the async variants that return CompletableFuture.
- */
-@Deprecated
-public interface Cancellable {
-
-  /**
-   * Request to cancel the asynchronous request. This may be a no-op in some situations, for
-   * instance, if the request failed or otherwise is complete.
-   */
-  void cancel();
-}
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/DebugAsyncListener.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/DebugAsyncListener.java
deleted file mode 100644
index f6db888..0000000
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/DebugAsyncListener.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.solr.client.solrj.impl;
-
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CountDownLatch;
-import org.apache.solr.client.solrj.SolrRequest;
-import org.apache.solr.client.solrj.util.AsyncListener;
-import org.apache.solr.common.util.NamedList;
-import org.junit.Assert;
-
-@Deprecated
-public class DebugAsyncListener
-    implements AsyncListener<NamedList<Object>>, PauseableHttpSolrClient {
-
-  private final CountDownLatch latch;
-
-  public volatile boolean onStartCalled;
-
-  public volatile boolean latchCounted;
-
-  public volatile NamedList<Object> onSuccessResult = null;
-
-  public volatile Throwable onFailureResult = null;
-
-  public DebugAsyncListener(CountDownLatch latch) {
-    this.latch = latch;
-  }
-
-  @Override
-  public void onStart() {
-    onStartCalled = true;
-  }
-
-  @Override
-  public void onSuccess(NamedList<Object> entries) {
-    pause();
-    onSuccessResult = entries;
-    if (latchCounted) {
-      Assert.fail("either 'onSuccess' or 'onFailure' should be called exactly once.");
-    }
-    latch.countDown();
-    latchCounted = true;
-    unPause();
-  }
-
-  @Override
-  public void onFailure(Throwable throwable) {
-    pause();
-    onFailureResult = throwable;
-    if (latchCounted) {
-      Assert.fail("either 'onSuccess' or 'onFailure' should be called exactly once.");
-    }
-    latch.countDown();
-    latchCounted = true;
-    unPause();
-  }
-
-  @Override
-  public CompletableFuture<NamedList<Object>> requestAsync(
-      SolrRequest<?> solrRequest, String collection) {
-    throw new UnsupportedOperationException();
-  }
-}
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java
index 620c240..c1c2580 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java
@@ -266,33 +266,18 @@
   }
 
   @Test
-  public void testDeprecatedAsyncGet() throws Exception {
-    super.testQueryAsync(true);
-  }
-
-  @Test
   public void testAsyncGet() throws Exception {
-    super.testQueryAsync(false);
-  }
-
-  @Test
-  public void testDeprecatedAsyncPost() throws Exception {
-    super.testUpdateAsync(true);
+    super.testQueryAsync();
   }
 
   @Test
   public void testAsyncPost() throws Exception {
-    super.testUpdateAsync(false);
-  }
-
-  @Test
-  public void testDeprecatedAsyncException() throws Exception {
-    super.testAsyncExceptionBase(true);
+    super.testUpdateAsync();
   }
 
   @Test
   public void testAsyncException() throws Exception {
-    super.testAsyncExceptionBase(false);
+    super.testAsyncExceptionBase();
   }
 
   @Test
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpJdkSolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpJdkSolrClientTest.java
index 5cbfaa3..e5af5bd 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpJdkSolrClientTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpJdkSolrClientTest.java
@@ -29,9 +29,6 @@
 import java.util.Collections;
 import java.util.Objects;
 import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CompletionException;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
@@ -46,10 +43,8 @@
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.request.QueryRequest;
 import org.apache.solr.client.solrj.request.RequestWriter;
 import org.apache.solr.client.solrj.response.SolrPingResponse;
-import org.apache.solr.client.solrj.util.Cancellable;
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.MapSolrParams;
 import org.apache.solr.common.util.ExecutorUtil;
@@ -200,37 +195,18 @@
   }
 
   @Test
-  public void testDeprecatedAsyncGet() throws Exception {
-    super.testQueryAsync(true);
-  }
-
-  @Test
   public void testAsyncGet() throws Exception {
-    super.testQueryAsync(false);
-  }
-
-  @Test
-  public void testDeprecatedAsyncPost() throws Exception {
-    super.testUpdateAsync(true);
+    super.testQueryAsync();
   }
 
   @Test
   public void testAsyncPost() throws Exception {
-    super.testUpdateAsync(false);
-  }
-
-  @Test
-  public void testDeprecatedAsyncException() throws Exception {
-    DebugAsyncListener listener = super.testAsyncExceptionBase(true);
-    assertTrue(listener.onFailureResult instanceof CompletionException);
-    CompletionException ce = (CompletionException) listener.onFailureResult;
-    assertTrue(ce.getCause() instanceof BaseHttpSolrClient.RemoteSolrException);
-    assertTrue(ce.getMessage(), ce.getMessage().contains("mime type"));
+    super.testUpdateAsync();
   }
 
   @Test
   public void testAsyncException() throws Exception {
-    super.testAsyncExceptionBase(false);
+    super.testAsyncExceptionBase();
   }
 
   @Test
@@ -280,50 +256,6 @@
   }
 
   @Test
-  public void testDeprecatedAsyncAndCancel() throws Exception {
-    ResponseParser rp = new XMLResponseParser();
-    DebugServlet.clear();
-    DebugServlet.addResponseHeader("Content-Type", "application/xml; charset=UTF-8");
-    DebugServlet.responseBodyByQueryFragment.put(
-        "", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<response />");
-    String url = getBaseUrl() + DEBUG_SERVLET_PATH;
-    HttpJdkSolrClient.Builder b = builder(url).withResponseParser(rp);
-    CountDownLatch latch = new CountDownLatch(0);
-    DebugAsyncListener listener = new DebugAsyncListener(latch);
-    Cancellable cancelMe = null;
-    try (HttpJdkSolrClient client = b.build()) {
-      QueryRequest query = new QueryRequest(new MapSolrParams(Collections.singletonMap("id", "1")));
-
-      // We are pausing in the "whenComplete" stage, in the unlikely event the http request
-      // finishes before the test calls "cancel".
-      listener.pause();
-
-      // Make the request then immediately cancel it!
-      cancelMe = client.asyncRequest(query, "collection1", listener);
-      cancelMe.cancel();
-
-      // We are safe to unpause our client, having guaranteed that our cancel was before everything
-      // completed.
-      listener.unPause();
-    }
-
-    // "onStart" fires before the async call.  This part of the request cannot be cancelled.
-    assertTrue(listener.onStartCalled);
-
-    // The client exposes the CompletableFuture to us via this inner class
-    assertTrue(cancelMe instanceof HttpJdkSolrClient.HttpSolrClientCancellable);
-    CompletableFuture<NamedList<Object>> response =
-        ((HttpJdkSolrClient.HttpSolrClientCancellable) cancelMe).getResponse();
-
-    // Even if our cancel didn't happen until we were at "whenComplete", the CompletableFuture will
-    // have set "isCancelled".
-    assertTrue(response.isCancelled());
-
-    // But we cannot guarantee the response will have been returned, or that "onFailure" was fired
-    // with a "CompletionException".  This depends on where we were when the cancellation hit.
-  }
-
-  @Test
   public void testTimeout() throws Exception {
     SolrQuery q = new SolrQuery("*:*");
     try (HttpJdkSolrClient client =
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java
index 76b5f07..977275f 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java
@@ -43,7 +43,6 @@
 import org.apache.solr.client.solrj.request.SolrPing;
 import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.client.solrj.util.Cancellable;
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrInputDocument;
@@ -544,16 +543,12 @@
         "No authorization headers expected. Headers: " + DebugServlet.headers, authorizationHeader);
   }
 
-  protected void testUpdateAsync(boolean useDeprecatedApi) throws Exception {
+  protected void testUpdateAsync() throws Exception {
     ResponseParser rp = new XMLResponseParser();
     String url = getBaseUrl();
     HttpSolrClientBuilderBase<?, ?> b =
         builder(url, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT).withResponseParser(rp);
     int limit = 10;
-
-    DebugAsyncListener[] listeners = new DebugAsyncListener[limit]; // Deprecated API use
-    Cancellable[] cancellables = new Cancellable[limit]; // Deprecated API use
-
     CountDownLatch latch = new CountDownLatch(limit);
 
     try (HttpSolrClientBase client = b.build()) {
@@ -573,12 +568,7 @@
         ur.add("id", "KEY-" + i);
         ur.setMethod(SolrRequest.METHOD.POST);
 
-        if (useDeprecatedApi) {
-          listeners[i] = new DebugAsyncListener(latch);
-          client.asyncRequest(ur, COLLECTION_1, listeners[i]);
-        } else {
-          client.requestAsync(ur, COLLECTION_1).whenComplete((nl, e) -> latch.countDown());
-        }
+        client.requestAsync(ur, COLLECTION_1).whenComplete((nl, e) -> latch.countDown());
       }
       latch.await(1, TimeUnit.MINUTES);
       client.commit(COLLECTION_1);
@@ -597,7 +587,7 @@
     }
   }
 
-  protected void testQueryAsync(boolean useDeprecatedApi) throws Exception {
+  protected void testQueryAsync() throws Exception {
     ResponseParser rp = new XMLResponseParser();
     DebugServlet.clear();
     DebugServlet.addResponseHeader("Content-Type", "application/xml; charset=UTF-8");
@@ -606,10 +596,6 @@
         builder(url, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT).withResponseParser(rp);
     int limit = 10;
 
-    CountDownLatch latch = new CountDownLatch(limit); // Deprecated API use
-    DebugAsyncListener[] listeners = new DebugAsyncListener[limit]; // Deprecated API use
-    Cancellable[] cancellables = new Cancellable[limit]; // Deprecated API use
-
     List<CompletableFuture<NamedList<Object>>> futures = new ArrayList<>();
 
     try (HttpSolrClientBase client = b.build()) {
@@ -622,24 +608,11 @@
         QueryRequest query =
             new QueryRequest(new MapSolrParams(Collections.singletonMap("id", "KEY-" + i)));
         query.setMethod(SolrRequest.METHOD.GET);
-        if (useDeprecatedApi) {
-          listeners[i] = new DebugAsyncListener(latch);
-          client.asyncRequest(query, null, listeners[i]);
-        } else {
-          futures.add(client.requestAsync(query));
-        }
-      }
-      if (useDeprecatedApi) {
-        latch.await(1, TimeUnit.MINUTES);
+        futures.add(client.requestAsync(query));
       }
 
       for (int i = 0; i < limit; i++) {
-        NamedList<Object> result;
-        if (useDeprecatedApi) {
-          result = listeners[i].onSuccessResult;
-        } else {
-          result = futures.get(i).get(1, TimeUnit.MINUTES);
-        }
+        NamedList<Object> result = futures.get(i).get(1, TimeUnit.MINUTES);
         SolrDocumentList sdl = (SolrDocumentList) result.get("response");
         assertEquals(2, sdl.getNumFound());
         assertEquals(1, sdl.getStart());
@@ -647,18 +620,12 @@
         assertEquals(1, sdl.size());
         assertEquals(1, sdl.iterator().next().size());
         assertEquals("KEY-" + i, sdl.iterator().next().get("id"));
-
-        if (useDeprecatedApi) {
-          assertNull(listeners[i].onFailureResult);
-          assertTrue(listeners[i].onStartCalled);
-        } else {
-          assertFalse(futures.get(i).isCompletedExceptionally());
-        }
+        assertFalse(futures.get(i).isCompletedExceptionally());
       }
     }
   }
 
-  protected DebugAsyncListener testAsyncExceptionBase(boolean useDeprecatedApi) throws Exception {
+  protected void testAsyncExceptionBase() throws Exception {
     ResponseParser rp = new XMLResponseParser();
     DebugServlet.clear();
     DebugServlet.addResponseHeader("Content-Type", "Wrong Content Type!");
@@ -666,40 +633,20 @@
     HttpSolrClientBuilderBase<?, ?> b =
         builder(url, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT).withResponseParser(rp);
 
-    CompletableFuture<NamedList<Object>> future = null;
-    ExecutionException ee = null;
-
-    CountDownLatch latch = new CountDownLatch(1); // Deprecated API use
-    DebugAsyncListener listener = new DebugAsyncListener(latch); // Deprecated API use
-
     try (HttpSolrClientBase client = b.build()) {
       QueryRequest query = new QueryRequest(new MapSolrParams(Collections.singletonMap("id", "1")));
-      if (useDeprecatedApi) {
-        client.asyncRequest(query, COLLECTION_1, listener);
-      } else {
-        future = client.requestAsync(query, COLLECTION_1);
+      CompletableFuture<NamedList<Object>> future = client.requestAsync(query, COLLECTION_1);
+      ExecutionException ee = null;
+      try {
+        future.get(1, TimeUnit.MINUTES);
+        fail("Should have thrown ExecutionException");
+      } catch (ExecutionException ee1) {
+        ee = ee1;
       }
-      if (useDeprecatedApi) {
-        latch.await(1, TimeUnit.MINUTES);
-      } else {
-        try {
-          future.get(1, TimeUnit.MINUTES);
-          fail("Should have thrown ExecutionException");
-        } catch (ExecutionException ee1) {
-          ee = ee1;
-        }
-      }
-    }
-    if (useDeprecatedApi) {
-      assertNotNull(listener.onFailureResult);
-      assertTrue(listener.onStartCalled);
-      assertNull(listener.onSuccessResult);
-    } else {
       assertTrue(future.isCompletedExceptionally());
       assertTrue(ee.getCause() instanceof BaseHttpSolrClient.RemoteSolrException);
       assertTrue(ee.getMessage(), ee.getMessage().contains("mime type"));
     }
-    return listener;
   }
 
   protected void testAsyncAndCancel(PauseableHttpSolrClient client) throws Exception {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttp2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttp2SolrClientTest.java
index 8e29050..203f050 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttp2SolrClientTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttp2SolrClientTest.java
@@ -23,15 +23,12 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import org.apache.solr.SolrTestCase;
 import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.request.QueryRequest;
-import org.apache.solr.client.solrj.util.AsyncListener;
-import org.apache.solr.client.solrj.util.Cancellable;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.MapSolrParams;
 import org.apache.solr.common.util.NamedList;
@@ -69,16 +66,6 @@
   }
 
   @Test
-  public void testAsyncDeprecated() {
-    testAsync(true);
-  }
-
-  @Test
-  public void testAsync() {
-    testAsync(false);
-  }
-
-  @Test
   public void testAsyncWithFailures() {
 
     // This demonstrates that the failing endpoint always gets retried, and it is up to the user
@@ -138,7 +125,8 @@
     }
   }
 
-  private void testAsync(boolean useDeprecatedApi) {
+  @Test
+  public void testAsync() {
     LBSolrClient.Endpoint ep1 = new LBSolrClient.Endpoint("http://endpoint.one");
     LBSolrClient.Endpoint ep2 = new LBSolrClient.Endpoint("http://endpoint.two");
     List<LBSolrClient.Endpoint> endpointList = List.of(ep1, ep2);
@@ -149,31 +137,12 @@
         LBHttp2SolrClient testClient = new LBHttp2SolrClient.Builder(client, ep1, ep2).build()) {
 
       int limit = 10; // For simplicity use an even limit
-
-      CountDownLatch latch = new CountDownLatch(limit); // deprecated API use
-      List<LBTestAsyncListener> listeners = new ArrayList<>(); // deprecated API use
       List<CompletableFuture<LBSolrClient.Rsp>> responses = new ArrayList<>();
 
       for (int i = 0; i < limit; i++) {
         QueryRequest queryRequest = new QueryRequest(new MapSolrParams(Map.of("q", "" + i)));
         LBSolrClient.Req req = new LBSolrClient.Req(queryRequest, endpointList);
-        if (useDeprecatedApi) {
-          LBTestAsyncListener listener = new LBTestAsyncListener(latch);
-          listeners.add(listener);
-          testClient.asyncReq(req, listener);
-        } else {
-          responses.add(testClient.requestAsync(req));
-        }
-      }
-
-      if (useDeprecatedApi) {
-        try {
-          // This is just a formality.  This is a single-threaded test.
-          latch.await(1, TimeUnit.MINUTES);
-        } catch (InterruptedException ie) {
-          Thread.currentThread().interrupt();
-          fail("interrupted");
-        }
+        responses.add(testClient.requestAsync(req));
       }
 
       QueryRequest[] queryRequests = new QueryRequest[limit];
@@ -191,25 +160,17 @@
         } else if (lastQueryReq.getBasePath().equals(ep2.toString())) {
           numEndpointTwo++;
         }
-        NamedList<Object> lastResponse;
-        if (useDeprecatedApi) {
-          LBTestAsyncListener lastAsyncListener = listeners.get(index);
-          assertTrue(lastAsyncListener.onStartCalled);
-          assertNull(lastAsyncListener.failure);
-          assertNotNull(lastAsyncListener.success);
-          lastResponse = lastAsyncListener.success.getResponse();
-        } else {
-          LBSolrClient.Rsp lastRsp = null;
-          try {
-            lastRsp = responses.get(index).get();
-          } catch (InterruptedException ie) {
-            Thread.currentThread().interrupt();
-            fail("interrupted");
-          } catch (ExecutionException ee) {
-            fail("Response " + index + " ended in failure: " + ee);
-          }
-          lastResponse = lastRsp.getResponse();
+
+        LBSolrClient.Rsp lastRsp = null;
+        try {
+          lastRsp = responses.get(index).get();
+        } catch (InterruptedException ie) {
+          Thread.currentThread().interrupt();
+          fail("interrupted");
+        } catch (ExecutionException ee) {
+          fail("Response " + index + " ended in failure: " + ee);
         }
+        NamedList<Object> lastResponse = lastRsp.getResponse();
 
         // The Mock will return {"response": index}.
         assertEquals("" + index, lastResponse.get("response"));
@@ -226,44 +187,6 @@
     }
   }
 
-  @Deprecated(forRemoval = true)
-  public static class LBTestAsyncListener implements AsyncListener<LBSolrClient.Rsp> {
-    private final CountDownLatch latch;
-    private volatile boolean countDownCalled = false;
-    public boolean onStartCalled = false;
-    public LBSolrClient.Rsp success = null;
-    public Throwable failure = null;
-
-    public LBTestAsyncListener(CountDownLatch latch) {
-      this.latch = latch;
-    }
-
-    @Override
-    public void onStart() {
-      onStartCalled = true;
-    }
-
-    @Override
-    public void onSuccess(LBSolrClient.Rsp entries) {
-      success = entries;
-      countdown();
-    }
-
-    @Override
-    public void onFailure(Throwable throwable) {
-      failure = throwable;
-      countdown();
-    }
-
-    private void countdown() {
-      if (countDownCalled) {
-        throw new IllegalStateException("Already counted down.");
-      }
-      latch.countDown();
-      countDownCalled = true;
-    }
-  }
-
   public static class MockHttp2SolrClient extends Http2SolrClient {
 
     public List<SolrRequest<?>> lastSolrRequests = new ArrayList<>();
@@ -282,14 +205,6 @@
     }
 
     @Override
-    public Cancellable asyncRequest(
-        SolrRequest<?> solrRequest,
-        String collection,
-        AsyncListener<NamedList<Object>> asyncListener) {
-      throw new UnsupportedOperationException("do not use deprecated method.");
-    }
-
-    @Override
     public CompletableFuture<NamedList<Object>> requestAsync(
         final SolrRequest<?> solrRequest, String collection) {
       CompletableFuture<NamedList<Object>> cf = new CompletableFuture<>();