You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ro...@apache.org on 2016/07/28 09:56:26 UTC
[2/2] lucene-solr:branch_6x: SOLR-9106: Add javadocs to ZkStateReader
cluster properties methods
SOLR-9106: Add javadocs to ZkStateReader cluster properties methods
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/8247f9f0
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/8247f9f0
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/8247f9f0
Branch: refs/heads/branch_6x
Commit: 8247f9f0cd8fccf7ecfb6d76cb8f180079ece3bb
Parents: f34a9ec
Author: Alan Woodward <ro...@apache.org>
Authored: Thu Jul 28 09:34:38 2016 +0100
Committer: Alan Woodward <ro...@apache.org>
Committed: Thu Jul 28 10:56:07 2016 +0100
----------------------------------------------------------------------
.../apache/solr/common/cloud/ZkStateReader.java | 21 ++++++++++++++++++++
1 file changed, 21 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8247f9f0/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index 227a8b3..9928346 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -825,6 +825,18 @@ public class ZkStateReader implements Closeable {
this.aliases = ClusterState.load(data);
}
+ /**
+ * Get a cluster property
+ *
+ * N.B. Cluster properties are updated via ZK watchers, and so may not necessarily
+ * be completely up-to-date. If you need to get the latest version, then use a
+ * {@link ClusterProperties} instance.
+ *
+ * @param key the property to read
+ * @param defaultValue a default value to use if no such property exists
+ * @param <T> the type of the property
+ * @return the cluster property, or a default if the property is not set
+ */
@SuppressWarnings("unchecked")
public <T> T getClusterProperty(String key, T defaultValue) {
T value = (T) clusterProperties.get(key);
@@ -833,6 +845,15 @@ public class ZkStateReader implements Closeable {
return value;
}
+ /**
+ * Get all cluster properties for this cluster
+ *
+ * N.B. Cluster properties are updated via ZK watchers, and so may not necessarily
+ * be completely up-to-date. If you need to get the latest version, then use a
+ * {@link ClusterProperties} instance.
+ *
+ * @return a Map of cluster properties
+ */
public Map<String, Object> getClusterProperties() {
return Collections.unmodifiableMap(clusterProperties);
}