From c2db9fae2cc312a13a66e6dab9989ed65738fe02 Mon Sep 17 00:00:00 2001 From: Alan Woodward Date: Thu, 28 Jul 2016 09:34:38 +0100 Subject: [PATCH] SOLR-9106: Add javadocs to ZkStateReader cluster properties methods --- .../solr/common/cloud/ZkStateReader.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) 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 227a8b3d55d..9928346c22b 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 the type of the property + * @return the cluster property, or a default if the property is not set + */ @SuppressWarnings("unchecked") public 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 getClusterProperties() { return Collections.unmodifiableMap(clusterProperties); }