You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ja...@apache.org on 2022/03/11 09:11:46 UTC

[solr] branch branch_9x updated: SOLR-15223 Deprecate HttpSolrClient and friends in 9.0 (#732)

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

janhoy 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 8e4c185  SOLR-15223 Deprecate HttpSolrClient and friends in 9.0 (#732)
8e4c185 is described below

commit 8e4c18585d3b6bac7cd9a8bda5175721cf5d68ff
Author: Jan Høydahl <ja...@users.noreply.github.com>
AuthorDate: Fri Mar 11 09:37:11 2022 +0100

    SOLR-15223 Deprecate HttpSolrClient and friends in 9.0 (#732)
    
    (cherry picked from commit 77921bab52f5a3ec11626759ab72e0a6f0b62092)
---
 solr/CHANGES.txt                                           |  2 ++
 .../org/apache/solr/client/solrj/impl/CloudSolrClient.java |  3 +++
 .../solr/client/solrj/impl/ClusterStateProvider.java       |  1 +
 .../solr/client/solrj/impl/ConcurrentUpdateSolrClient.java |  3 +++
 .../org/apache/solr/client/solrj/impl/HttpClientUtil.java  |  2 ++
 .../solr/client/solrj/impl/HttpClusterStateProvider.java   |  7 ++++++-
 .../org/apache/solr/client/solrj/impl/HttpSolrClient.java  | 14 ++++++++++++--
 .../solr/client/solrj/impl/Krb5HttpClientBuilder.java      |  7 ++++++-
 .../apache/solr/client/solrj/impl/LBHttpSolrClient.java    |  2 ++
 .../org/apache/solr/client/solrj/impl/PreemptiveAuth.java  |  3 +++
 .../impl/PreemptiveBasicAuthClientBuilderFactory.java      |  3 +++
 .../apache/solr/client/solrj/impl/SolrClientBuilder.java   |  4 ++++
 .../solr/client/solrj/impl/SolrHttpClientBuilder.java      |  2 ++
 .../client/solrj/impl/SolrHttpClientContextBuilder.java    |  4 ++++
 .../client/solrj/impl/SolrHttpRequestRetryHandler.java     |  4 ++++
 .../org/apache/solr/client/solrj/io/SolrClientCache.java   |  9 ++++++++-
 .../org/apache/solr/client/solrj/io/stream/SolrStream.java |  2 ++
 17 files changed, 67 insertions(+), 5 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 1f84789..fc318db 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -609,6 +609,8 @@ and each individual module's jar will be included in its directory's lib/ folder
 
 * SOLR-16039: Upgrade to Hadoop 3.3.2 (Kevin Risden)
 
+* SOLR-15223: Deprecate HttpSolrClient and friends, please use the Http2SolrClient equivalents (janhoy, David Smiley)
+
 Bug Fixes
 ---------------------
 * SOLR-15849: Fix the connection reset problem caused by the incorrect use of 4LW with \n when monitoring zooKeeper status (Fa Ming).
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 98ebb90..54b2c6d 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
@@ -36,7 +36,10 @@ import org.apache.solr.common.util.NamedList;
  * SolrJ client class to communicate with SolrCloud. Instances of this class communicate with
  * Zookeeper to discover Solr endpoints for SolrCloud collections, and then use the {@link
  * LBHttpSolrClient} to issue requests.
+ *
+ * @deprecated Please use {@link CloudHttp2SolrClient}
  */
+@Deprecated(since = "9.0")
 public class CloudSolrClient extends BaseCloudSolrClient {
 
   private final ClusterStateProvider stateProvider;
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 f858ef8..6f6fb04 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
@@ -25,6 +25,7 @@ import org.apache.solr.common.cloud.ClusterState;
 import org.apache.solr.common.cloud.DocCollection;
 import org.apache.solr.common.params.CollectionAdminParams;
 
+/** Provides cluster state from some source */
 public interface ClusterStateProvider extends SolrCloseable {
 
   /**
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java
index 112f80a..953c519 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java
@@ -69,7 +69,10 @@ import org.slf4j.MDC;
  * <p>Although any SolrClient request can be made with this implementation, it is only recommended
  * to use ConcurrentUpdateSolrClient with /update requests. The class {@link HttpSolrClient} is
  * better suited for the query interface.
+ *
+ * @deprecated Please use {@link ConcurrentUpdateHttp2SolrClient}
  */
+@Deprecated(since = "9.0")
 public class ConcurrentUpdateSolrClient extends SolrClient {
   private static final long serialVersionUID = 1L;
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
index 8fd1e8f..90fc938 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
@@ -70,7 +70,9 @@ import org.slf4j.LoggerFactory;
  * <p>This class can touch internal HttpClient details and is subject to change.
  *
  * @lucene.experimental
+ * @deprecated Used to configure the Apache HTTP client. Please use The Http2 client
  */
+@Deprecated(since = "9.0")
 public class HttpClientUtil {
 
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClusterStateProvider.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClusterStateProvider.java
index f2eafc4..56c6b08 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClusterStateProvider.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClusterStateProvider.java
@@ -21,7 +21,12 @@ import java.util.List;
 import org.apache.http.client.HttpClient;
 import org.apache.solr.client.solrj.SolrClient;
 
-/** Retrieves cluster state via Solr HTTP APIs */
+/**
+ * Retrieves cluster state via Solr HTTP APIs
+ *
+ * @deprecated Please use {@link Http2ClusterStateProvider}
+ */
+@Deprecated(since = "9.0")
 public class HttpClusterStateProvider extends BaseHttpClusterStateProvider {
 
   private final HttpClient httpClient;
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
index 86b56fb..3085e2a 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
@@ -90,7 +90,12 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.MDC;
 
-/** A SolrClient implementation that talks directly to a Solr server via HTTP */
+/**
+ * A SolrClient implementation that talks directly to a Solr server via Apache HTTP client
+ *
+ * @deprecated Please use {@link Http2SolrClient}
+ */
+@Deprecated(since = "9.0")
 public class HttpSolrClient extends BaseHttpSolrClient {
 
   private static final Charset FALLBACK_CHARSET = StandardCharsets.UTF_8;
@@ -858,7 +863,12 @@ public class HttpSolrClient extends BaseHttpSolrClient {
     this.useMultiPartPost = useMultiPartPost;
   }
 
-  /** Constructs {@link HttpSolrClient} instances from provided configuration. */
+  /**
+   * Constructs {@link HttpSolrClient} instances from provided configuration.
+   *
+   * @deprecated Please use {@link Http2SolrClient}
+   */
+  @Deprecated(since = "9.0")
   public static class Builder extends SolrClientBuilder<Builder> {
     protected String baseSolrUrl;
     protected boolean compression;
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Krb5HttpClientBuilder.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Krb5HttpClientBuilder.java
index e228477..d39f26c 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Krb5HttpClientBuilder.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Krb5HttpClientBuilder.java
@@ -47,7 +47,12 @@ import org.eclipse.jetty.client.util.SPNEGOAuthentication;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/** Kerberos-enabled SolrHttpClientBuilder */
+/**
+ * Kerberos-enabled SolrHttpClientBuilder
+ *
+ * @deprecated Please consider alternatives involving the new Solr Http2Client
+ */
+@Deprecated(since = "9.0")
 public class Krb5HttpClientBuilder implements HttpClientBuilderFactory {
 
   public static final String LOGIN_CONFIG_PROP = "java.security.auth.login.config";
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java
index 6710f44..f299c5a 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java
@@ -67,7 +67,9 @@ import org.apache.solr.common.params.ModifiableSolrParams;
  * href="http://en.wikipedia.org/wiki/Load_balancing_(computing)">Load balancing on Wikipedia</a>
  *
  * @since solr 1.4
+ * @deprecated Please use {@link LBHttp2SolrClient}
  */
+@Deprecated(since = "9.0")
 public class LBHttpSolrClient extends LBSolrClient {
 
   private final HttpClient httpClient;
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveAuth.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveAuth.java
index f47cd6f..2b8c047 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveAuth.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveAuth.java
@@ -34,7 +34,10 @@ import org.apache.http.protocol.HttpContext;
  * This implementation is required since Solr client is not capable of performing non preemptive
  * authentication. By adding the Http authentication credentials to every request, this interceptor
  * enables "preemptive" authentication.
+ *
+ * @deprecated Please look into using Solr's new Http2 clients
  */
+@Deprecated(since = "9.0")
 public class PreemptiveAuth implements HttpRequestInterceptor {
   private AuthScheme authScheme = null;
 
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientBuilderFactory.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientBuilderFactory.java
index 329d1ce..fb32351 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientBuilderFactory.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientBuilderFactory.java
@@ -43,7 +43,10 @@ import org.eclipse.jetty.client.WWWAuthenticationProtocolHandler;
 /**
  * HttpClientConfigurer implementation providing support for preemptive Http Basic authentication
  * scheme.
+ *
+ * @deprecated Please look into using Solr's new Http2 clients
  */
+@Deprecated(since = "9.0")
 public class PreemptiveBasicAuthClientBuilderFactory implements HttpClientBuilderFactory {
   /**
    * A system property used to specify a properties file containing default parameters used for
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientBuilder.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientBuilder.java
index 3a0ce26..8a9ec98 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientBuilder.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientBuilder.java
@@ -20,6 +20,10 @@ import org.apache.http.client.HttpClient;
 import org.apache.solr.client.solrj.ResponseParser;
 import org.apache.solr.client.solrj.impl.HttpSolrClient.Builder;
 
+/**
+ * @deprecated Please look into using Solr's new Http2 clients
+ */
+@Deprecated(since = "9.0")
 public abstract class SolrClientBuilder<B extends SolrClientBuilder<B>> {
 
   protected HttpClient httpClient;
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpClientBuilder.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpClientBuilder.java
index 66ae783..82bfc21 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpClientBuilder.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpClientBuilder.java
@@ -26,7 +26,9 @@ import org.apache.http.cookie.CookieSpecProvider;
  * implementation and is subject to change.
  *
  * @lucene.experimental
+ * @deprecated Please look into using Solr's new Http2 clients
  */
+@Deprecated(since = "9.0")
 public class SolrHttpClientBuilder {
   public static SolrHttpClientBuilder create() {
     return new SolrHttpClientBuilder();
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpClientContextBuilder.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpClientContextBuilder.java
index 9c55b91..1908813 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpClientContextBuilder.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpClientContextBuilder.java
@@ -22,6 +22,10 @@ import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.config.Lookup;
 import org.apache.http.cookie.CookieSpecProvider;
 
+/**
+ * @deprecated Please look into using Solr's new Http2 clients
+ */
+@Deprecated(since = "9.0")
 public class SolrHttpClientContextBuilder {
   public static SolrHttpClientContextBuilder create() {
     return new SolrHttpClientContextBuilder();
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpRequestRetryHandler.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpRequestRetryHandler.java
index 0d50b4b..4ec079a 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpRequestRetryHandler.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpRequestRetryHandler.java
@@ -36,6 +36,10 @@ import org.apache.http.protocol.HttpContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * @deprecated Please look into using Solr's new Http2 clients
+ */
+@Deprecated(since = "9.0")
 public class SolrHttpRequestRetryHandler implements HttpRequestRetryHandler {
 
   private static final String GET = "GET";
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java
index 24d39dc..28d0d36 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java
@@ -33,7 +33,11 @@ import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/** The SolrClientCache caches SolrClients so they can be reused by different TupleStreams. */
+/**
+ * The SolrClientCache caches SolrClients so they can be reused by different TupleStreams.
+ *
+ * <p>TODO: Cut this over to using Solr's new Http2 clients
+ */
 public class SolrClientCache implements Serializable {
 
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -54,10 +58,12 @@ public class SolrClientCache implements Serializable {
     httpClient = null;
   }
 
+  @Deprecated(since = "9.0")
   public SolrClientCache(HttpClient httpClient) {
     this.httpClient = httpClient;
   }
 
+  @Deprecated(since = "9.0")
   public synchronized CloudSolrClient getCloudSolrClient(String zkHost) {
 
     // Timeouts should never be lower then 60000 but they can be set higher
@@ -92,6 +98,7 @@ public class SolrClientCache implements Serializable {
     return client;
   }
 
+  @Deprecated(since = "9.0")
   public synchronized HttpSolrClient getHttpSolrClient(String host) {
     HttpSolrClient client;
     if (solrClients.containsKey(host)) {
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java
index a41b5b1..9118339 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java
@@ -46,6 +46,8 @@ import org.apache.solr.common.util.NamedList;
 /**
  * Queries a single Solr instance and maps SolrDocs to a Stream of Tuples.
  *
+ * <p>TODO: Move this to Http2SolrClient
+ *
  * @since 5.1.0
  */
 public class SolrStream extends TupleStream {