Apache Solr open-source search software
SolrJ: CloudSolrClient, HTTP StateProvider: Use EnvUtils to customize a cache timeout (#2629)
aparnasuresh8590dc8d994c25
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.javaindex 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 ClusterStateProvidvolatile 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 ClusterStateProvidreturn 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 {}