@NotThreadSafe public final class ServerConfiguration extends Object
Global configuration properties of Alluxio. This class works like a dictionary and serves each Alluxio configuration property as a key-value pair.
Alluxio configuration properties are loaded into this class in the following order with decreasing priority:
alluxio-env.sh
or from OS settings;alluxio-site.properties
file;
The default properties are defined in the PropertyKey
class in the codebase. Alluxio
users can override values of these default properties by creating alluxio-site.properties
and putting it under java CLASSPATH
when running Alluxio (e.g., ${ALLUXIO_HOME}/conf/)
This class defines many convenient static methods which delegate to an internal
InstancedConfiguration
. To use this global configuration in a method that takes
AlluxioConfiguration
as an argument, pass global()
.
Modifier and Type | Method and Description |
---|---|
static AlluxioProperties |
copyProperties()
Create and return a copy of all properties.
|
static String |
get(PropertyKey key)
Gets the value for the given key in the
Properties ; if this key is not found, a
RuntimeException is thrown. |
static String |
get(PropertyKey key,
ConfigurationValueOptions options)
Gets the value for the given key in the
Properties ; if this key is not found, a
RuntimeException is thrown. |
static boolean |
getBoolean(PropertyKey key)
Gets the boolean representation of the value for the given key.
|
static long |
getBytes(PropertyKey key)
Gets the bytes of the value for the given key.
|
static <T> Class<T> |
getClass(PropertyKey key)
Gets the value for the given key as a class.
|
static double |
getDouble(PropertyKey key)
Gets the double representation of the value for the given key.
|
static java.time.Duration |
getDuration(PropertyKey key)
Gets the time of the key as a duration.
|
static <T extends Enum<T>> |
getEnum(PropertyKey key,
Class<T> enumType)
Gets the value for the given key as an enum value.
|
static float |
getFloat(PropertyKey key)
Gets the float representation of the value for the given key.
|
static int |
getInt(PropertyKey key)
Gets the integer representation of the value for the given key.
|
static List<String> |
getList(PropertyKey key,
String delimiter)
Gets the value for the given key as a list.
|
static long |
getLong(PropertyKey key)
Gets the long representation of the value for the given key.
|
static long |
getMs(PropertyKey key)
Gets the time of key in millisecond unit.
|
static Map<String,String> |
getNestedProperties(PropertyKey prefixKey)
Gets a set of properties that share a given common prefix key as a map.
|
static String |
getOrDefault(PropertyKey key,
String defaultValue) |
static String |
getOrDefault(PropertyKey key,
String defaultValue,
ConfigurationValueOptions options) |
static Source |
getSource(PropertyKey key) |
static InstancedConfiguration |
global() |
static String |
hash() |
static boolean |
isSet(PropertyKey key)
Checks if the configuration contains a value for the given key.
|
static Set<PropertyKey> |
keySet() |
static void |
loadClusterDefaultsIfNotLoaded(InetSocketAddress address)
Loads cluster default values from the meta master if it's not loaded yet.
|
static void |
merge(Map<?,?> properties,
Source source)
Merges the current configuration properties with new properties.
|
static void |
reset()
Resets the
AlluxioConfiguration back the defaults and values from
alluxio-site properties. |
static void |
set(PropertyKey key,
Object value)
Sets the value for the appropriate key in the
Properties . |
static void |
set(PropertyKey key,
Object value,
Source source)
Sets the value for the appropriate key in the
Properties by source. |
static Map<String,String> |
toMap() |
static Map<String,String> |
toMap(ConfigurationValueOptions opts) |
static void |
unset(PropertyKey key)
Unsets the value for the appropriate key in the
Properties . |
public static void reset()
AlluxioConfiguration
back the defaults and values from
alluxio-site properties.public static AlluxioProperties copyProperties()
public static void merge(Map<?,?> properties, Source source)
properties
- the source Properties
to be mergedsource
- the source of the the properties (e.g., system property, default and etc)public static void set(PropertyKey key, Object value)
Properties
.key
- the key to setvalue
- the value for the keypublic static void set(PropertyKey key, Object value, Source source)
Properties
by source.key
- the key to setvalue
- the value for the keysource
- the source of the the properties (e.g., system property, default and etc)public static void unset(PropertyKey key)
Properties
.key
- the key to unsetpublic static String get(PropertyKey key)
Properties
; if this key is not found, a
RuntimeException is thrown.key
- the key to get the value forpublic static String get(PropertyKey key, ConfigurationValueOptions options)
Properties
; if this key is not found, a
RuntimeException is thrown.key
- the key to get the value foroptions
- options for getting configuration valuepublic static String getOrDefault(PropertyKey key, String defaultValue)
key
- the key to get the value fordefaultValue
- the value to return if no value is set for the specified keypublic static String getOrDefault(PropertyKey key, String defaultValue, ConfigurationValueOptions options)
key
- the key to get the value fordefaultValue
- the value to return if no value is set for the specified keyoptions
- options for getting configuration valuepublic static boolean isSet(PropertyKey key)
key
- the key to checkpublic static Set<PropertyKey> keySet()
public static int getInt(PropertyKey key)
key
- the key to get the value forint
public static long getLong(PropertyKey key)
key
- the key to get the value forlong
public static double getDouble(PropertyKey key)
key
- the key to get the value fordouble
public static float getFloat(PropertyKey key)
key
- the key to get the value forfloat
public static boolean getBoolean(PropertyKey key)
key
- the key to get the value forboolean
public static List<String> getList(PropertyKey key, String delimiter)
key
- the key to get the value fordelimiter
- the delimiter to split the valuespublic static <T extends Enum<T>> T getEnum(PropertyKey key, Class<T> enumType)
T
- the type of the enumkey
- the key to get the value forenumType
- the type of the enumpublic static long getBytes(PropertyKey key)
key
- the key to get the value forpublic static long getMs(PropertyKey key)
key
- the key to get the value forpublic static java.time.Duration getDuration(PropertyKey key)
key
- the key to get the value forpublic static <T> Class<T> getClass(PropertyKey key)
T
- the type of the classkey
- the key to get the value forpublic static Map<String,String> getNestedProperties(PropertyKey prefixKey)
prefixKey
- the prefix keypublic static Source getSource(PropertyKey key)
key
- the property keypublic static Map<String,String> toMap()
public static Map<String,String> toMap(ConfigurationValueOptions opts)
opts
- options for formatting the configuration valuespublic static InstancedConfiguration global()
InstancedConfiguration
object backing the global configurationpublic static void loadClusterDefaultsIfNotLoaded(InetSocketAddress address) throws AlluxioStatusException
address
- the master addressAlluxioStatusException
public static String hash()
Copyright © 2023. All Rights Reserved.