Class ConfigUtils


  • public class ConfigUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getClientConfigStr​(java.lang.String configData)  
      static java.lang.String[] getHostAndPort​(java.lang.String s)
      Gets host and port by splitting server config with support for IPv6 literals
      static java.lang.String getPropertyBackwardCompatibleWay​(java.lang.String newPropertyKey)
      Some old configuration properties are not configurable in zookeeper configuration file zoo.cfg.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConfigUtils

        public ConfigUtils()
    • Method Detail

      • getClientConfigStr

        public static java.lang.String getClientConfigStr​(java.lang.String configData)
      • getHostAndPort

        public static java.lang.String[] getHostAndPort​(java.lang.String s)
                                                 throws QuorumPeerConfig.ConfigException
        Gets host and port by splitting server config with support for IPv6 literals
        Parameters:
        s - server config, server:port
        Returns:
        String[] first element being the IP address and the next being the port
        Throws:
        QuorumPeerConfig.ConfigException
      • getPropertyBackwardCompatibleWay

        public static java.lang.String getPropertyBackwardCompatibleWay​(java.lang.String newPropertyKey)
        Some old configuration properties are not configurable in zookeeper configuration file zoo.cfg. To make these properties configurable in zoo.cfg old properties are prepended with zookeeper. For example prop.x.y.z changed to zookeeper.prop.x.y.z. But for backward compatibility both prop.x.y.z and zookeeper.prop.x.y.z should be supported. This method first gets value from new property, if first property is not configured then gets value from old property
        Parameters:
        newPropertyKey - new property key which starts with zookeeper.
        Returns:
        either new or old system property value. Null if none of the properties are set.