public class ZKConfig extends Object
setProperty(String, String).| Modifier and Type | Field and Description |
|---|---|
static String |
JGSS_NATIVE |
static String |
JUTE_MAXBUFFER |
static String |
KINIT_COMMAND
Path to a kinit binary: "zookeeper.kinit".
|
| Constructor and Description |
|---|
ZKConfig()
properties, which are common to both client and server, are initialized
from system properties
|
ZKConfig(File configFile)
Deprecated.
|
ZKConfig(Path configPath)
Constructs a
ZKConfig with properties from file. |
ZKConfig(String configPath)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConfiguration(File configFile)
Deprecated.
|
void |
addConfiguration(Path configPath)
Add a configuration resource.
|
void |
addConfiguration(String configPath)
Deprecated.
|
boolean |
getBoolean(String key)
Returns
true if and only if the property named by the argument
exists and is equal to the string "true". |
boolean |
getBoolean(String key,
boolean defaultValue)
Get the value of the
key property as a boolean. |
int |
getInt(String key,
int defaultValue)
Get the value of the
key property as an int. |
String |
getJaasConfKey()
Return the value of "java.security.auth.login.config" system property
|
String |
getProperty(String key)
Get the property value
|
String |
getProperty(String key,
String defaultValue)
Get the property value, if it is null return default value
|
protected void |
handleBackwardCompatibility()
Now onwards client code will use properties from this class but older
clients still be setting properties through system properties.
|
void |
setProperty(String key,
String value)
Maps the specified
key to the specified value. |
public static final String JUTE_MAXBUFFER
public static final String KINIT_COMMAND
"/usr/bin/kinit"public static final String JGSS_NATIVE
public ZKConfig()
@Deprecated public ZKConfig(String configPath) throws QuorumPeerConfig.ConfigException
Use ZKConfig(Path configPath) instead.
The signature of this method will be changed to throw ConfigException
instead of QuorumPeerConfig.ConfigException in future release.
configPath - Configuration file pathConfigException - if failed to load configuration propertiesQuorumPeerConfig.ConfigException@Deprecated public ZKConfig(File configFile) throws QuorumPeerConfig.ConfigException
Use ZKConfig(Path configPath) instead.
The signature of this method will be changed to throw ConfigException
instead of QuorumPeerConfig.ConfigException in future release.
configFile - Configuration fileConfigException - if failed to load configuration propertiesQuorumPeerConfig.ConfigExceptionpublic ZKConfig(Path configPath) throws ConfigException
ZKConfig with properties from file.configPath - path to configuration fileConfigExceptionprotected void handleBackwardCompatibility()
public String getProperty(String key)
key - public String getProperty(String key, String defaultValue)
key - property keydefaultValue - public String getJaasConfKey()
public void setProperty(String key, String value)
key to the specified value.
key can not be null. If key is already mapped then the old
value of the key is replaced by the specified
value.key - value - public void addConfiguration(Path configPath) throws ConfigException
configPath - path to Configuration file.ConfigException@Deprecated public void addConfiguration(File configFile) throws QuorumPeerConfig.ConfigException
Use addConfiguration(Path) instead.
The signature of this method will be changed to throw ConfigException
instead of QuorumPeerConfig.ConfigException in future release.
Add a configuration resource. The properties form this configuration will overwrite corresponding already loaded property and system property
configFile - Configuration file.QuorumPeerConfig.ConfigException@Deprecated public void addConfiguration(String configPath) throws QuorumPeerConfig.ConfigException
Use addConfiguration(Path) instead.
The signature of this method will be changed to throw ConfigException
instead of QuorumPeerConfig.ConfigException in future release.
Add a configuration resource. The properties form this configuration will overwrite corresponding already loaded property and system property
configPath - Configuration file path.QuorumPeerConfig.ConfigExceptionpublic boolean getBoolean(String key)
true if and only if the property named by the argument
exists and is equal to the string "true".public boolean getBoolean(String key, boolean defaultValue)
key property as a boolean. Returns
true if and only if the property named by the argument exists and is equal
to the string "true". If the property is not set, the provided
defaultValue is returned.key - property key.defaultValue - default value.boolean, or
defaultValuepublic int getInt(String key, int defaultValue)
key property as an int. If
property is not set, the provided defaultValue is returnedkey - property key.defaultValue - default value.int, or
defaultValueNumberFormatException - when the value is invalidCopyright © 2008–2026 The Apache Software Foundation. All rights reserved.