Class ZKConfig
- Direct Known Subclasses:
ZKClientConfig
setProperty(String, String).- Since:
- 3.5.2
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConfiguration(File configFile) Deprecated.voidaddConfiguration(String configPath) Deprecated.voidaddConfiguration(Path configPath) Add a configuration resource.booleangetBoolean(String key) Returnstrueif and only if the property named by the argument exists and is equal to the string"true".booleangetBoolean(String key, boolean defaultValue) Get the value of thekeyproperty as aboolean.intGet the value of thekeyproperty as anint.Return the value of "java.security.auth.login.config" system propertygetProperty(String key) Get the property valuegetProperty(String key, String defaultValue) Get the property value, if it is null return default valueprotected voidNow onwards client code will use properties from this class but older clients still be setting properties through system properties.voidsetProperty(String key, String value) Maps the specifiedkeyto the specifiedvalue.
-
Field Details
-
JUTE_MAXBUFFER
- See Also:
-
KINIT_COMMAND
Path to a kinit binary: "zookeeper.kinit". Defaults to"/usr/bin/kinit"- See Also:
-
JGSS_NATIVE
- See Also:
-
-
Constructor Details
-
ZKConfig
public ZKConfig()properties, which are common to both client and server, are initialized from system properties -
ZKConfig
Deprecated.Use
ZKConfig(Path configPath)instead.The signature of this method will be changed to throw
ConfigExceptioninstead ofQuorumPeerConfig.ConfigExceptionin future release.- Parameters:
configPath- Configuration file path- Throws:
ConfigException- if failed to load configuration propertiesQuorumPeerConfig.ConfigException
-
ZKConfig
Deprecated.Use
ZKConfig(Path configPath)instead.The signature of this method will be changed to throw
ConfigExceptioninstead ofQuorumPeerConfig.ConfigExceptionin future release.- Parameters:
configFile- Configuration file- Throws:
ConfigException- if failed to load configuration propertiesQuorumPeerConfig.ConfigException
-
ZKConfig
Constructs aZKConfigwith properties from file.- Parameters:
configPath- path to configuration file- Throws:
ConfigException
-
-
Method Details
-
handleBackwardCompatibility
protected void handleBackwardCompatibility()Now onwards client code will use properties from this class but older clients still be setting properties through system properties. So to make this change backward compatible we should set old system properties in this configuration. -
getProperty
-
getProperty
-
getJaasConfKey
Return the value of "java.security.auth.login.config" system property- Returns:
- value
-
setProperty
-
addConfiguration
Add a configuration resource. The properties form this configuration will overwrite corresponding already loaded property and system property- Parameters:
configPath- path to Configuration file.- Throws:
ConfigException
-
addConfiguration
Deprecated.Use
addConfiguration(Path)instead.The signature of this method will be changed to throw
ConfigExceptioninstead ofQuorumPeerConfig.ConfigExceptionin future release.Add a configuration resource. The properties form this configuration will overwrite corresponding already loaded property and system property
- Parameters:
configFile- Configuration file.- Throws:
QuorumPeerConfig.ConfigException
-
addConfiguration
Deprecated.Use
addConfiguration(Path)instead.The signature of this method will be changed to throw
ConfigExceptioninstead ofQuorumPeerConfig.ConfigExceptionin future release.Add a configuration resource. The properties form this configuration will overwrite corresponding already loaded property and system property
- Parameters:
configPath- Configuration file path.- Throws:
QuorumPeerConfig.ConfigException
-
getBoolean
Returnstrueif and only if the property named by the argument exists and is equal to the string"true". -
getBoolean
Get the value of thekeyproperty as aboolean. Returnstrueif and only if the property named by the argument exists and is equal to the string"true". If the property is not set, the provideddefaultValueis returned.- Parameters:
key- property key.defaultValue- default value.- Returns:
- return property value as an
boolean, ordefaultValue
-
getInt
Get the value of thekeyproperty as anint. If property is not set, the provideddefaultValueis returned- Parameters:
key- property key.defaultValue- default value.- Returns:
- return property value as an
int, ordefaultValue - Throws:
NumberFormatException- when the value is invalid
-