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

epugh 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 2642def9b23 SOLR-10470: setParallelCacheRefreshes should be deprecated 
in favor of SolrClientBuilder methods (#1248)
2642def9b23 is described below

commit 2642def9b23f0ffd993c1755ee924033b652821e
Author: Eric Pugh <[email protected]>
AuthorDate: Sat Dec 31 17:11:47 2022 -0500

    SOLR-10470: setParallelCacheRefreshes should be deprecated in favor of 
SolrClientBuilder methods (#1248)
    
    Introduce Builder setter for parallelCacheRefreshes on cloud SolrClients.  
Deprecated direct setter setParallelCacheRefreshes on cloud SolrClients.  
Inlined logic for creating object locks.
---
 solr/CHANGES.txt                                         |  5 ++++-
 .../solr/client/solrj/impl/CloudHttp2SolrClient.java     | 16 ++++++++++++++++
 .../apache/solr/client/solrj/impl/CloudSolrClient.java   |  5 ++++-
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 5cb23c19109..c9a456cb744 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -74,11 +74,14 @@ Improvements
 
 * SOLR-10462: Introduce Builder setter for pollQueueTime on 
ConcurrentUpdateHttp2SolrClient.  Deprecated 
   direct setter setPollQueueTime on ConcurrentUpdateHttp2SolrClient. (Eric 
Pugh)
-
+  
 * SOLR-10452: Introduce Builder setter withTheseParamNamesInTheUrl for 
queryParams, renaming them to urlParamNames
   to clarify they are parameter names, not the values. Deprecated direct 
setter setQueryParams and addQueryParams 
   on SolrClients. (Eric Pugh, David Smiley, Alex Deparvu)
   
+* SOLR-10470: Introduce Builder setter for parallelCacheRefreshes on cloud 
SolrClients.  Deprecated
+  direct setter setParallelCacheRefreshes on cloud SolrClients. (Eric Pugh, 
David Smiley, Alex Deparvu)
+  
 Optimizations
 ---------------------
 
diff --git 
a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java
 
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java
index 4692eede98c..04eb2f7f0d6 100644
--- 
a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java
+++ 
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java
@@ -98,6 +98,10 @@ public class CloudHttp2SolrClient extends CloudSolrClient {
       this.stateProvider = builder.stateProvider;
     }
 
+    //  If caches are expired then they are refreshed after acquiring a lock. 
Set the number of
+    // locks.
+    this.locks = objectList(builder.parallelCacheRefreshesLocks);
+
     this.lbClient = new LBHttp2SolrClient.Builder(myClient).build();
   }
 
@@ -147,6 +151,7 @@ public class CloudHttp2SolrClient extends CloudSolrClient {
     private ResponseParser responseParser;
     private long retryExpiryTime =
         TimeUnit.NANOSECONDS.convert(3, TimeUnit.SECONDS); // 3 seconds or 3 
million nanos
+    private int parallelCacheRefreshesLocks = 3;
 
     /**
      * Provide a series of Solr URLs to be used when configuring {@link 
CloudHttp2SolrClient}
@@ -249,6 +254,17 @@ public class CloudHttp2SolrClient extends CloudSolrClient {
       return this;
     }
 
+    /**
+     * When caches are expired then they are refreshed after acquiring a lock. 
Use this to set the
+     * number of locks.
+     *
+     * <p>Defaults to 3.
+     */
+    public Builder setParallelCacheRefreshes(int parallelCacheRefreshesLocks) {
+      this.parallelCacheRefreshesLocks = parallelCacheRefreshesLocks;
+      return this;
+    }
+
     /**
      * This is the time to wait to refetch the state after getting the same 
state version from ZK
      */
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 ea997a62158..ccc328ff23b 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
@@ -126,7 +126,7 @@ public abstract class CloudSolrClient extends SolrClient {
 
   }
 
-  private volatile List<Object> locks = objectList(3);
+  protected volatile List<Object> locks = objectList(3);
 
   /** Constructs {@link CloudSolrClient} instances from provided 
configuration. */
   public static class Builder extends CloudHttp2SolrClient.Builder {
@@ -1222,7 +1222,10 @@ public abstract class CloudSolrClient extends SolrClient 
{
   /**
    * If caches are expired they are refreshed after acquiring a lock. use this 
to set the number of
    * locks
+   *
+   * @deprecated use {@link 
CloudHttp2SolrClient.Builder#setParallelCacheRefreshes(int)} instead
    */
+  @Deprecated
   public void setParallelCacheRefreshes(int n) {
     locks = objectList(n);
   }

Reply via email to