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
      • update

        public void update​(MapWriter obj,
                           String... path)
                    throws org.apache.zookeeper.KeeperException,
                           InterruptedException
        Set this object at the json path
        Parameters:
        obj - the Object to be set
        path - the json path
        Throws:
        org.apache.zookeeper.KeeperException
        InterruptedException
      • 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