This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 90dc8d994c2 SolrJ: CloudSolrClient, HTTP StateProvider: Use EnvUtils
to customize a cache timeout (#2629)
90dc8d994c2 is described below
commit 90dc8d994c25599f1d43fb7e602967ee21a081ca
Author: aparnasuresh85 <[email protected]>
AuthorDate: Tue Aug 13 11:54:54 2024 -0400
SolrJ: CloudSolrClient, HTTP StateProvider: Use EnvUtils to customize a
cache timeout (#2629)
New "solr.solrj.cache.timeout.sec" setting which will affect
HttpClusterStateProvider caching of liveNodes and aliases.
---
.../solr/client/solrj/impl/BaseHttpClusterStateProvider.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git
a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpClusterStateProvider.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpClusterStateProvider.java
index 2555a0cba4f..d9186057ef7 100644
---
a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpClusterStateProvider.java
+++
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpClusterStateProvider.java
@@ -39,6 +39,7 @@ import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.cloud.PerReplicaStates;
import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.EnvUtils;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.common.util.Utils;
@@ -55,7 +56,8 @@ public abstract class BaseHttpClusterStateProvider implements
ClusterStateProvid
volatile Map<String, Map<String, String>> aliasProperties;
long aliasesTimestamp = 0;
- private int cacheTimeout = 5; // the liveNodes and aliases cache will be
invalidated after 5 secs
+ // the liveNodes and aliases cache will be invalidated after 5 secs
+ private int cacheTimeout =
EnvUtils.getPropertyAsInteger("solr.solrj.cache.timeout.sec", 5);
public void init(List<String> solrUrls) throws Exception {
for (String solrUrl : solrUrls) {
@@ -411,10 +413,6 @@ public abstract class BaseHttpClusterStateProvider
implements ClusterStateProvid
return cacheTimeout;
}
- public void setCacheTimeout(int cacheTimeout) {
- this.cacheTimeout = cacheTimeout;
- }
-
// This exception is not meant to escape this class it should be caught and
wrapped.
private static class NotACollectionException extends Exception {}