Class ClusterProperties


  • public class ClusterProperties
    extends Object
    Interact with solr cluster properties Note that all methods on this class make calls to ZK on every invocation. For read-only eventually-consistent uses, clients should instead call ZkStateReader.getClusterProperty(String, Object)
    • Constructor Detail

      • ClusterProperties

        public ClusterProperties​(SolrZkClient client)
        Creates a ClusterProperties object using a provided SolrZkClient
    • Method Detail

      • getClusterProperty

        public <T> T getClusterProperty​(String key,
                                        T defaultValue)
                                 throws IOException
        Read the value of a cluster property, returning a default if it is not set
        Type Parameters:
        T - the type of the property
        Parameters:
        key - the property name or the full path to the property.
        defaultValue - the default value
        Returns:
        the property value
        Throws:
        IOException - if there is an error reading the value from the cluster
      • getClusterProperty

        public <T> T getClusterProperty​(List<String> key,
                                        T defaultValue)
                                 throws IOException
        Read the value of a cluster property, returning a default if it is not set
        Type Parameters:
        T - the type of the property
        Parameters:
        key - the property name or the full path to the property as a list of parts.
        defaultValue - the default value
        Returns:
        the property value
        Throws:
        IOException - if there is an error reading the value from the cluster
      • getClusterProperties

        public Map<String,​Object> getClusterProperties()
                                                      throws IOException
        Return the cluster properties
        Throws:
        IOException - if there is an error reading properties from the cluster
      • setClusterProperty

        public void setClusterProperty​(String propertyName,
                                       Object propertyValue)
                                throws IOException
        This method sets a cluster property.
        Parameters:
        propertyName - The property name to be set.
        propertyValue - The value of the property, could also be a nested structure.
        Throws:
        IOException - if there is an error writing data to the cluster