This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new be12a5aea54 Deprecations for Solr 9 (#3159)
be12a5aea54 is described below

commit be12a5aea54a615ec0f48052aeb51eee2ba45640
Author: David Smiley <[email protected]>
AuthorDate: Mon Mar 17 21:24:46 2025 -0400

    Deprecations for Solr 9 (#3159)
    
    Deprecations, for Solr 9, removable in 10.
    
    * Deprecated `LocalSolrQueryRequest` class in favor of 
`SolrQueryRequestBase`.
    * Deprecated `DirectSolrConnection` class and suggested using 
`EmbeddedSolrServer`.
    * Deprecated `MockSearchableSolrClient` class.
    * Deprecated `getClusterState()` and `connect()` methods in 
`CloudSolrClient`.  Moved a connect() implementation to its only caller in 
streaming SQL ConnectionImpl.
    * ... more
    
    * Replaced `DocCollection.getReplicas(nodeName)` with 
`getReplicasOnNode(nodeName)`  (clearer)
    
    (cherry picked from commit 1e4497039df10fa24bdb6ebd53f2ce9df45533d9)
---
 .../java/org/apache/solr/cloud/ZkController.java   |  3 +-
 .../apache/solr/cloud/overseer/NodeMutator.java    |  2 +-
 .../apache/solr/request/LocalSolrQueryRequest.java |  2 +-
 .../org/apache/solr/request/SolrQueryRequest.java  |  4 ++
 .../apache/solr/servlet/DirectSolrConnection.java  |  2 +
 .../java/org/apache/solr/servlet/HttpSolrCall.java |  2 +-
 .../apache/solr/util/MockSearchableSolrClient.java |  1 +
 .../test/org/apache/solr/cloud/DeleteNodeTest.java |  2 +-
 .../org/apache/solr/cloud/MigrateReplicasTest.java | 12 +++---
 .../org/apache/solr/cloud/ReplaceNodeTest.java     | 16 ++++----
 .../apache/solr/search/TestCoordinatorRole.java    |  4 +-
 .../solr/client/solrj/io/sql/ConnectionImpl.java   | 48 +++++++++++++++++++---
 .../solr/client/solrj/impl/CloudSolrClient.java    | 12 ++++++
 .../client/solrj/impl/ClusterStateProvider.java    |  1 +
 .../solr/client/solrj/impl/NoOpResponseParser.java |  3 ++
 .../client/solrj/request/DirectXmlRequest.java     |  2 +
 .../org/apache/solr/common/MapSerializable.java    |  7 +++-
 .../org/apache/solr/common/cloud/ClusterState.java |  4 +-
 .../apache/solr/common/cloud/DocCollection.java    |  9 ++++
 .../org/apache/solr/common/util/NamedList.java     |  8 ++++
 20 files changed, 113 insertions(+), 31 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java 
b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index 7eafa88028e..31b3128c9db 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -862,7 +862,6 @@ public class ZkController implements Closeable {
               .withHttpClient(cc.getDefaultHttpSolrClient())
               .build();
       cloudManager = new SolrClientCloudManager(cloudSolrClient, 
cc.getObjectCache());
-      cloudManager.getClusterStateProvider().connect();
     }
     return cloudManager;
   }
@@ -1106,7 +1105,7 @@ public class ZkController implements Closeable {
           (collectionState) -> {
             if (collectionState == null) return false;
             boolean allStatesCorrect =
-                
Optional.ofNullable(collectionState.getReplicas(nodeName)).stream()
+                
Optional.ofNullable(collectionState.getReplicasOnNode(nodeName)).stream()
                     .flatMap(List::stream)
                     .allMatch(replica -> replica.getState() == 
Replica.State.DOWN);
 
diff --git a/solr/core/src/java/org/apache/solr/cloud/overseer/NodeMutator.java 
b/solr/core/src/java/org/apache/solr/cloud/overseer/NodeMutator.java
index f9069cb7831..38301a14a90 100644
--- a/solr/core/src/java/org/apache/solr/cloud/overseer/NodeMutator.java
+++ b/solr/core/src/java/org/apache/solr/cloud/overseer/NodeMutator.java
@@ -72,7 +72,7 @@ public class NodeMutator {
     List<String> downedReplicas = new ArrayList<>();
     final Map<String, Slice> slicesCopy = new 
LinkedHashMap<>(docCollection.getSlicesMap());
 
-    List<Replica> replicasOnNode = docCollection.getReplicas(nodeName);
+    List<Replica> replicasOnNode = docCollection.getReplicasOnNode(nodeName);
     if (replicasOnNode == null || replicasOnNode.isEmpty()) {
       return Optional.empty();
     }
diff --git 
a/solr/core/src/java/org/apache/solr/request/LocalSolrQueryRequest.java 
b/solr/core/src/java/org/apache/solr/request/LocalSolrQueryRequest.java
index 02b36e9c3e4..b01021f0362 100644
--- a/solr/core/src/java/org/apache/solr/request/LocalSolrQueryRequest.java
+++ b/solr/core/src/java/org/apache/solr/request/LocalSolrQueryRequest.java
@@ -30,7 +30,7 @@ import org.apache.solr.core.SolrCore;
 // With the addition of SolrParams, this class isn't needed for much 
anymore... it's currently
 // retained more for backward compatibility.
 
-/** */
+@Deprecated // use SolrQueryRequestBase
 public class LocalSolrQueryRequest extends SolrQueryRequestBase {
   public String userPrincipalName = null;
 
diff --git a/solr/core/src/java/org/apache/solr/request/SolrQueryRequest.java 
b/solr/core/src/java/org/apache/solr/request/SolrQueryRequest.java
index bc6c9da4305..4dfce550bc0 100644
--- a/solr/core/src/java/org/apache/solr/request/SolrQueryRequest.java
+++ b/solr/core/src/java/org/apache/solr/request/SolrQueryRequest.java
@@ -194,6 +194,10 @@ public interface SolrQueryRequest extends AutoCloseable {
     return core == null ? null : core.getCoreContainer();
   }
 
+  /**
+   * @deprecated use getCore().getCoreDescriptor().getCloudDescriptor()
+   */
+  @Deprecated
   default CloudDescriptor getCloudDescriptor() {
     return getCore().getCoreDescriptor().getCloudDescriptor();
   }
diff --git 
a/solr/core/src/java/org/apache/solr/servlet/DirectSolrConnection.java 
b/solr/core/src/java/org/apache/solr/servlet/DirectSolrConnection.java
index f7b5f59b48a..aa4337a6679 100644
--- a/solr/core/src/java/org/apache/solr/servlet/DirectSolrConnection.java
+++ b/solr/core/src/java/org/apache/solr/servlet/DirectSolrConnection.java
@@ -42,7 +42,9 @@ import org.apache.solr.response.SolrQueryResponse;
  * interface to Solr.
  *
  * @since solr 1.2
+ * @deprecated see {@link 
org.apache.solr.client.solrj.embedded.EmbeddedSolrServer}
  */
+@Deprecated
 public class DirectSolrConnection {
   protected final SolrCore core;
   protected final SolrRequestParsers parser;
diff --git a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java 
b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
index 5c06364462e..9c847663907 100644
--- a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
+++ b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
@@ -1062,7 +1062,7 @@ public class HttpSolrCall {
       if (core != null) return core;
     }
 
-    List<Replica> replicas = 
collection.getReplicas(cores.getZkController().getNodeName());
+    List<Replica> replicas = 
collection.getReplicasOnNode(cores.getZkController().getNodeName());
     return randomlyGetSolrCore(liveNodes, replicas);
   }
 
diff --git 
a/solr/core/src/java/org/apache/solr/util/MockSearchableSolrClient.java 
b/solr/core/src/java/org/apache/solr/util/MockSearchableSolrClient.java
index 6f4a52e95f6..c98b9b5d94b 100644
--- a/solr/core/src/java/org/apache/solr/util/MockSearchableSolrClient.java
+++ b/solr/core/src/java/org/apache/solr/util/MockSearchableSolrClient.java
@@ -38,6 +38,7 @@ import org.apache.solr.common.util.NamedList;
  * Simple mock client that collects added documents and supports simple search 
by id (both <code>
  * {!term f=id}</code> and <code>id:</code> syntax is supported) or *:*.
  */
+@Deprecated
 public class MockSearchableSolrClient extends SolrClient {
   public Map<String, Map<String, SolrInputDocument>> docs = new 
ConcurrentHashMap<>();
 
diff --git a/solr/core/src/test/org/apache/solr/cloud/DeleteNodeTest.java 
b/solr/core/src/test/org/apache/solr/cloud/DeleteNodeTest.java
index 9f8c33e60f7..527ac45dfa1 100644
--- a/solr/core/src/test/org/apache/solr/cloud/DeleteNodeTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/DeleteNodeTest.java
@@ -71,7 +71,7 @@ public class DeleteNodeTest extends SolrCloudTestCase {
     boolean shouldFail = false;
     DocCollection docColl = state.getCollection(coll);
     log.info("#### DocCollection: {}", docColl);
-    List<Replica> replicas = docColl.getReplicas(nodeToBeDecommissioned);
+    List<Replica> replicas = docColl.getReplicasOnNode(nodeToBeDecommissioned);
     if (replicas != null) {
       for (Replica replica : replicas) {
         String shard =
diff --git a/solr/core/src/test/org/apache/solr/cloud/MigrateReplicasTest.java 
b/solr/core/src/test/org/apache/solr/cloud/MigrateReplicasTest.java
index 39ccf43fb53..9f8993f2ce6 100644
--- a/solr/core/src/test/org/apache/solr/cloud/MigrateReplicasTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/MigrateReplicasTest.java
@@ -147,7 +147,7 @@ public class MigrateReplicasTest extends SolrCloudTestCase {
     // check what are replica states on the decommissioned node
     assertNull(
         "There should not be any replicas left on decommissioned node",
-        collection.getReplicas(nodeToBeDecommissioned));
+        collection.getReplicasOnNode(nodeToBeDecommissioned));
 
     // let's do it back - this time wait for recoveries
     response =
@@ -183,14 +183,14 @@ public class MigrateReplicasTest extends 
SolrCloudTestCase {
           s.getReplicas(EnumSet.of(Replica.Type.PULL)).size());
     }
     // make sure all newly created replicas on node are active
-    List<Replica> newReplicas = collection.getReplicas(nodeToBeDecommissioned);
+    List<Replica> newReplicas = 
collection.getReplicasOnNode(nodeToBeDecommissioned);
     assertNotNull("There should be replicas on the migrated-to node", 
newReplicas);
     assertFalse("There should be replicas on the migrated-to node", 
newReplicas.isEmpty());
     for (Replica r : newReplicas) {
       assertEquals(r.toString(), Replica.State.ACTIVE, r.getState());
     }
     // make sure all replicas on emptyNode are not active
-    List<Replica> replicas = collection.getReplicas(emptyNode);
+    List<Replica> replicas = collection.getReplicasOnNode(emptyNode);
     if (replicas != null) {
       for (Replica r : replicas) {
         assertNotEquals(r.toString(), Replica.State.ACTIVE, r.getState());
@@ -272,7 +272,7 @@ public class MigrateReplicasTest extends SolrCloudTestCase {
     log.info("### Before decommission: {}", initialCollection);
     List<Integer> initialReplicaCounts =
         l.stream()
-            .map(node -> initialCollection.getReplicas(node).size())
+            .map(node -> initialCollection.getReplicasOnNode(node).size())
             .collect(Collectors.toList());
     Map<?, ?> response =
         callMigrateReplicas(
@@ -289,7 +289,7 @@ public class MigrateReplicasTest extends SolrCloudTestCase {
     log.info("### After decommission: {}", collection);
     // check what are replica states on the decommissioned nodes
     for (String nodeToBeDecommissioned : nodesToBeDecommissioned) {
-      List<Replica> replicas = collection.getReplicas(nodeToBeDecommissioned);
+      List<Replica> replicas = 
collection.getReplicasOnNode(nodeToBeDecommissioned);
       if (replicas == null) {
         replicas = Collections.emptyList();
       }
@@ -303,7 +303,7 @@ public class MigrateReplicasTest extends SolrCloudTestCase {
       assertNotEquals(
           "The non-source node '" + node + "' should not receive all replicas 
from the migration",
           4,
-          collection.getReplicas(node).size());
+          collection.getReplicasOnNode(node).size());
     }
   }
 
diff --git a/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeTest.java 
b/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeTest.java
index 6333d7dd9ac..59427ff26df 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeTest.java
@@ -128,7 +128,7 @@ public class ReplaceNodeTest extends SolrCloudTestCase {
     collection = cloudClient.getClusterState().getCollection(coll);
     log.debug("### After decommission: {}", collection);
     // check what are replica states on the decommissioned node
-    List<Replica> replicas = collection.getReplicas(nodeToBeDecommissioned);
+    List<Replica> replicas = 
collection.getReplicasOnNode(nodeToBeDecommissioned);
     if (replicas == null) {
       replicas = Collections.emptyList();
     }
@@ -163,14 +163,14 @@ public class ReplaceNodeTest extends SolrCloudTestCase {
           s.getReplicas(EnumSet.of(Replica.Type.PULL)).size());
     }
     // make sure all newly created replicas on node are active
-    List<Replica> newReplicas = collection.getReplicas(nodeToBeDecommissioned);
+    List<Replica> newReplicas = 
collection.getReplicasOnNode(nodeToBeDecommissioned);
     replicas.forEach(r -> newReplicas.removeIf(nr -> 
nr.getName().equals(r.getName())));
     assertFalse(newReplicas.isEmpty());
     for (Replica r : newReplicas) {
       assertEquals(r.toString(), Replica.State.ACTIVE, r.getState());
     }
     // make sure all replicas on emptyNode are not active
-    replicas = collection.getReplicas(emptyNode);
+    replicas = collection.getReplicasOnNode(emptyNode);
     if (replicas != null) {
       for (Replica r : replicas) {
         assertNotEquals(r.toString(), Replica.State.ACTIVE, r.getState());
@@ -257,7 +257,7 @@ public class ReplaceNodeTest extends SolrCloudTestCase {
     log.info("excluded_nodes : {}  ", emptyNodes);
     List<Integer> initialReplicaCounts =
         l.stream()
-            .map(node -> initialCollection.getReplicas(node).size())
+            .map(node -> initialCollection.getReplicasOnNode(node).size())
             .collect(Collectors.toList());
     createReplaceNodeRequest(nodeToBeDecommissioned, null, true)
         .processAndWait("000", cloudClient, 15);
@@ -266,7 +266,7 @@ public class ReplaceNodeTest extends SolrCloudTestCase {
     assertNotNull("Collection cannot be null: " + coll, collection);
     log.debug("### After decommission: {}", collection);
     // check what are replica states on the decommissioned node
-    List<Replica> replicas = collection.getReplicas(nodeToBeDecommissioned);
+    List<Replica> replicas = 
collection.getReplicasOnNode(nodeToBeDecommissioned);
     if (replicas == null) {
       replicas = Collections.emptyList();
     }
@@ -274,8 +274,8 @@ public class ReplaceNodeTest extends SolrCloudTestCase {
         "There should be no more replicas on the sourceNode after a 
replaceNode request.",
         Collections.emptyList(),
         replicas);
-    int sizeA = collection.getReplicas(emptyNodes.get(0)).size();
-    int sizeB = collection.getReplicas(emptyNodes.get(1)).size();
+    int sizeA = collection.getReplicasOnNode(emptyNodes.get(0)).size();
+    int sizeB = collection.getReplicasOnNode(emptyNodes.get(1)).size();
     assertEquals(
         "The empty nodes should have a similar number of replicas placed on 
each", sizeA, sizeB, 1);
     assertEquals(
@@ -286,7 +286,7 @@ public class ReplaceNodeTest extends SolrCloudTestCase {
       assertEquals(
           "The number of replicas on non-empty and non-source nodes should not 
change",
           initialReplicaCounts.get(i).intValue(),
-          collection.getReplicas(l.get(i)).size());
+          collection.getReplicasOnNode(l.get(i)).size());
     }
   }
 
diff --git a/solr/core/src/test/org/apache/solr/search/TestCoordinatorRole.java 
b/solr/core/src/test/org/apache/solr/search/TestCoordinatorRole.java
index d14a98cf0f8..38ec012375b 100644
--- a/solr/core/src/test/org/apache/solr/search/TestCoordinatorRole.java
+++ b/solr/core/src/test/org/apache/solr/search/TestCoordinatorRole.java
@@ -365,7 +365,7 @@ public class TestCoordinatorRole extends SolrCloudTestCase {
             "Pull jetty replicas didn't become active in time",
             COLL,
             ((liveNodes, collectionState) ->
-                collectionState.getReplicas(pullJettyF.getNodeName()).stream()
+                
collectionState.getReplicasOnNode(pullJettyF.getNodeName()).stream()
                     .allMatch(rep -> rep.getState() == Replica.State.ACTIVE)));
         AtomicBoolean done = new AtomicBoolean();
         long runMinutes = 1;
@@ -396,7 +396,7 @@ public class TestCoordinatorRole extends SolrCloudTestCase {
                           toManipulate.getNodeName() + " replicas didn't 
become active in time",
                           COLL,
                           ((liveNodes, collectionState) ->
-                              
collectionState.getReplicas(toManipulate.getNodeName()).stream()
+                              
collectionState.getReplicasOnNode(toManipulate.getNodeName()).stream()
                                   .allMatch(rep -> rep.getState() == 
Replica.State.ACTIVE)));
                     } catch (Exception e) {
                       throw new RuntimeException(e);
diff --git 
a/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/sql/ConnectionImpl.java
 
b/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/sql/ConnectionImpl.java
index 548bf1918fc..ec942a44edb 100644
--- 
a/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/sql/ConnectionImpl.java
+++ 
b/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/sql/ConnectionImpl.java
@@ -16,6 +16,7 @@
  */
 package org.apache.solr.client.solrj.io.sql;
 
+import java.lang.invoke.MethodHandles;
 import java.sql.Array;
 import java.sql.Blob;
 import java.sql.CallableStatement;
@@ -38,9 +39,13 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.client.solrj.io.SolrClientCache;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 class ConnectionImpl implements Connection {
 
+  private static final Logger log = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
   private final String url;
   private final SolrClientCache solrClientCache = new SolrClientCache();
   private final CloudSolrClient client;
@@ -325,15 +330,11 @@ class ConnectionImpl implements Connection {
   }
 
   @Override
-  public boolean isValid(int timeout) throws SQLException {
+  public boolean isValid(int timeoutSec) throws SQLException {
     // check that the connection isn't closed and able to connect within the 
timeout
     try {
       if (!isClosed()) {
-        if (timeout == 0) {
-          this.client.connect();
-        } else {
-          this.client.connect(timeout, TimeUnit.SECONDS);
-        }
+        connect(client, timeoutSec, TimeUnit.SECONDS);
         return true;
       }
     } catch (InterruptedException | TimeoutException ignore) {
@@ -342,6 +343,41 @@ class ConnectionImpl implements Connection {
     return false;
   }
 
+  /**
+   * Connect to a cluster. If the cluster is not ready, retry connection up to 
a given timeout.
+   *
+   * @param duration the timeout. 0 means try once; no timeout.
+   * @param timeUnit the units of the timeout
+   * @throws TimeoutException if the cluster is not ready after the timeout
+   * @throws InterruptedException if the wait is interrupted
+   */
+  static void connect(CloudSolrClient client, long duration, TimeUnit timeUnit)
+      throws TimeoutException, InterruptedException {
+    var clusterStateProvider = client.getClusterStateProvider();
+    if (duration == 0) {
+      clusterStateProvider.getLiveNodes();
+      return;
+    }
+
+    log.info(
+        "Waiting for {} {} for cluster at {} to be ready",
+        duration,
+        timeUnit,
+        clusterStateProvider);
+    long timeout = System.nanoTime() + timeUnit.toNanos(duration);
+    while (System.nanoTime() < timeout) {
+      try {
+        clusterStateProvider.getLiveNodes();
+        log.info("Cluster at {} ready", clusterStateProvider);
+        return;
+      } catch (RuntimeException e) {
+        // not ready yet, then...
+      }
+      TimeUnit.MILLISECONDS.sleep(250);
+    }
+    throw new TimeoutException("Timed out waiting for cluster");
+  }
+
   @Override
   public void setClientInfo(String name, String value) throws 
SQLClientInfoException {
     throw new UnsupportedOperationException();
diff --git 
a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java 
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
index 3ab0d5e844a..0d734de0d27 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
@@ -299,7 +299,15 @@ public abstract class CloudSolrClient extends SolrClient {
 
   public abstract ClusterStateProvider getClusterStateProvider();
 
+  /**
+   * @deprecated problematic as a 'get' method, since one implementation will 
do a remote request
+   *     each time this is called, potentially return lots of data that isn't 
even needed.
+   */
+  @Deprecated
   public ClusterState getClusterState() {
+    // The future of "ClusterState" isn't clear.  Could make it more of a 
cache instead of a
+    // snapshot, so we un-deprecate. Or we avoid it and maybe make the 
ClusterStateProvider as that
+    // cache.  SOLR-17604 is related.
     return getClusterStateProvider().getClusterState();
   }
 
@@ -364,7 +372,10 @@ public abstract class CloudSolrClient extends SolrClient {
   /**
    * Connect to the zookeeper ensemble. This is an optional method that may be 
used to force a
    * connection before any other requests are sent.
+   *
+   * @deprecated Call {@link ClusterStateProvider#getLiveNodes()} instead.
    */
+  @Deprecated
   public void connect() {
     getClusterStateProvider().connect();
   }
@@ -377,6 +388,7 @@ public abstract class CloudSolrClient extends SolrClient {
    * @throws TimeoutException if the cluster is not ready after the timeout
    * @throws InterruptedException if the wait is interrupted
    */
+  @Deprecated
   public void connect(long duration, TimeUnit timeUnit)
       throws TimeoutException, InterruptedException {
     if (log.isInfoEnabled()) {
diff --git 
a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ClusterStateProvider.java
 
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ClusterStateProvider.java
index b6afac3114f..ce7c7f9c2e4 100644
--- 
a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ClusterStateProvider.java
+++ 
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ClusterStateProvider.java
@@ -123,6 +123,7 @@ public interface ClusterStateProvider extends SolrCloseable 
{
   /** Get the collection-specific policy */
   String getPolicyNameByCollection(String coll);
 
+  @Deprecated // just call getLiveNodes()
   void connect();
 
   String getQuorumHosts();
diff --git 
a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/NoOpResponseParser.java 
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/NoOpResponseParser.java
index 92101918db5..e5bbeebe0d4 100644
--- 
a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/NoOpResponseParser.java
+++ 
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/NoOpResponseParser.java
@@ -27,7 +27,10 @@ import org.apache.solr.common.util.NamedList;
 
 /**
  * A special parser that puts the entire response into a string "response" 
field in the NamedList.
+ *
+ * @deprecated see {@link InputStreamResponseParser instead}; more efficient
  */
+@Deprecated
 public class NoOpResponseParser extends ResponseParser {
 
   private String writerType = "xml";
diff --git 
a/solr/solrj/src/java/org/apache/solr/client/solrj/request/DirectXmlRequest.java
 
b/solr/solrj/src/java/org/apache/solr/client/solrj/request/DirectXmlRequest.java
index 4fbe8b08158..8d40bc8c294 100644
--- 
a/solr/solrj/src/java/org/apache/solr/client/solrj/request/DirectXmlRequest.java
+++ 
b/solr/solrj/src/java/org/apache/solr/client/solrj/request/DirectXmlRequest.java
@@ -26,7 +26,9 @@ import org.apache.solr.common.params.SolrParams;
  * Send arbitrary XML to a request handler
  *
  * @since solr 1.3
+ * @deprecated Use {@link GenericSolrRequest}.
  */
+@Deprecated
 public class DirectXmlRequest extends 
CollectionRequiringSolrRequest<UpdateResponse>
     implements IsUpdateRequest {
 
diff --git a/solr/solrj/src/java/org/apache/solr/common/MapSerializable.java 
b/solr/solrj/src/java/org/apache/solr/common/MapSerializable.java
index 6d3fcff9dad..e5d6ebafa92 100644
--- a/solr/solrj/src/java/org/apache/solr/common/MapSerializable.java
+++ b/solr/solrj/src/java/org/apache/solr/common/MapSerializable.java
@@ -18,7 +18,12 @@ package org.apache.solr.common;
 
 import java.util.Map;
 
-/** This is to facilitate just in time creation of objects before writing it 
to the response. */
+/**
+ * This is to facilitate just in time creation of objects before writing it to 
the response.
+ *
+ * @deprecated Use {@link MapWriter} instead
+ */
+@Deprecated
 public interface MapSerializable {
   /**
    * Use the passed map to minimize object creation. Do not keep a reference 
to the passed map and
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java 
b/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
index 34eff2a653b..9a0612b9026 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
@@ -214,7 +214,7 @@ public class ClusterState implements MapWriter {
       DocCollection coll = ref.get();
       if (coll == null) continue; // this collection got removed in between, 
skip
       // TODO: for really large clusters, we could 'index' on this
-      return Optional.ofNullable(coll.getReplicas(nodeName)).stream()
+      return Optional.ofNullable(coll.getReplicasOnNode(nodeName)).stream()
           .flatMap(List::stream)
           .filter(r -> coreName.equals(r.getStr(ReplicaStateProps.CORE_NAME)))
           .map(Replica::getShard)
@@ -232,7 +232,7 @@ public class ClusterState implements MapWriter {
         .filter(Objects::nonNull)
         .forEach(
             col -> {
-              List<Replica> replicas = col.getReplicas(nodeName);
+              List<Replica> replicas = col.getReplicasOnNode(nodeName);
               if (replicas != null && !replicas.isEmpty()) {
                 replicaNamesPerCollectionOnNode.put(col.getName(), replicas);
               }
diff --git 
a/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java 
b/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java
index 3f29088d2fc..8c828cef5b9 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java
@@ -356,7 +356,13 @@ public class DocCollection extends ZkNodeProps implements 
Iterable<Slice> {
   }
 
   /** Get the list of replicas hosted on the given node or <code>null</code> 
if none. */
+  @Deprecated // see getReplicasOnNode
   public List<Replica> getReplicas(String nodeName) {
+    return getReplicasOnNode(nodeName);
+  }
+
+  /** Get the list of replicas hosted on the given node or <code>null</code> 
if none. */
+  public List<Replica> getReplicasOnNode(String nodeName) {
     return nodeNameReplicas.get(nodeName);
   }
 
@@ -449,6 +455,7 @@ public class DocCollection extends ZkNodeProps implements 
Iterable<Slice> {
    *
    * @see CollectionStatePredicate
    */
+  @Deprecated // only for 2 tests
   public static boolean isFullyActive(
       Set<String> liveNodes,
       DocCollection collectionState,
@@ -510,6 +517,7 @@ public class DocCollection extends ZkNodeProps implements 
Iterable<Slice> {
   }
 
   /** Get the shardId of a core on a specific node */
+  @Deprecated // only one usage; obscure looking
   public String getShardId(String nodeName, String coreName) {
     for (Slice slice : this) {
       for (Replica replica : slice) {
@@ -567,6 +575,7 @@ public class DocCollection extends ZkNodeProps implements 
Iterable<Slice> {
     return perReplicaStatesRef != null ? perReplicaStatesRef.get() : null;
   }
 
+  @Deprecated
   public int getExpectedReplicaCount(Replica.Type type, int def) {
     Integer result = null;
     if (type == Replica.Type.NRT) result = numNrtReplicas;
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java 
b/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
index 76c23294e97..9d8993ee61c 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
@@ -278,7 +278,9 @@ public class NamedList<T>
    *
    * @return null if not found or if the value stored was null.
    * @see #indexOf
+   * @deprecated Use {@link #indexOf(String, int)} then {@link #getVal(int)}.
    */
+  @Deprecated
   public T get(String name, int start) {
     int sz = size();
     for (int i = start; i < sz; i++) {
@@ -347,7 +349,9 @@ public class NamedList<T>
    *
    * @param args One or more strings specifying the tree to navigate.
    * @return the last entry in the given path hierarchy, null if not found.
+   * @deprecated use {@link org.apache.solr.common.NavigableObject} methods 
instead
    */
+  @Deprecated
   public Object findRecursive(String... args) {
     NamedList<?> currentList = null;
     Object value = null;
@@ -409,6 +413,10 @@ public class NamedList<T>
     return new NamedList<>(Collections.unmodifiableList(copy.nvPairs));
   }
 
+  /**
+   * @deprecated Use {@link SimpleOrderedMap} instead.
+   */
+  @Deprecated
   public Map<String, T> asShallowMap() {
     return asShallowMap(false);
   }

Reply via email to