Class AbstractDynamicConfiguration
java.lang.Object
org.apache.dubbo.common.config.configcenter.AbstractDynamicConfiguration
- All Implemented Interfaces:
AutoCloseable,DynamicConfiguration,Configuration
- Direct Known Subclasses:
TreePathDynamicConfiguration
The abstract implementation of
DynamicConfiguration- Since:
- 2.7.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longDefault keep alive time in milliseconds for threads inThreadPoolExecutoris 1 minute( 60 * 1000 ms)static final Stringstatic final intstatic final StringThe parameter name of group for config-centerstatic final Stringstatic final StringThe keep alive time in milliseconds for threads inThreadPoolExecutorstatic final Stringstatic final Stringstatic final StringThe parameter name of timeout for config-centerFields inherited from interface org.apache.dubbo.common.config.Configuration
interfaceLevelLoggerFields inherited from interface org.apache.dubbo.common.config.configcenter.DynamicConfiguration
DEFAULT_GROUP -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(String key, String group, ConfigurationListener listener) Register a configuration listener for a specified key The listener only works for service governance purpose, so the target group would always be the value user specifies at startup or 'dubbo' by default.final voidclose()Close the configurationfinal StringGet the configuration mapped to the given key and the given group.Get the default group for the operationslongGet the default timeout for the operations in millisecondsbooleanremoveConfig(String key, String group) voidremoveListener(String key, String group, ConfigurationListener listener) Stops one listener from listening to value changes in the specified key.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.dubbo.common.config.Configuration
containsKey, convert, getBoolean, getBoolean, getBoolean, getInt, getInt, getInteger, getProperty, getProperty, getString, getStringMethods inherited from interface org.apache.dubbo.common.config.configcenter.DynamicConfiguration
addListener, getConfig, getConfigItem, getProperties, getProperties, publishConfig, publishConfig, publishConfigCas, removeListener
-
Field Details
-
PARAM_NAME_PREFIX
- See Also:
-
THREAD_POOL_PREFIX_PARAM_NAME
- See Also:
-
DEFAULT_THREAD_POOL_PREFIX
- See Also:
-
THREAD_POOL_SIZE_PARAM_NAME
- See Also:
-
THREAD_POOL_KEEP_ALIVE_TIME_PARAM_NAME
The keep alive time in milliseconds for threads inThreadPoolExecutor- See Also:
-
GROUP_PARAM_NAME
The parameter name of group for config-center- Since:
- 2.7.8
- See Also:
-
TIMEOUT_PARAM_NAME
The parameter name of timeout for config-center- Since:
- 2.7.8
- See Also:
-
DEFAULT_THREAD_POOL_SIZE
public static final int DEFAULT_THREAD_POOL_SIZE- See Also:
-
DEFAULT_THREAD_POOL_KEEP_ALIVE_TIME
public static final long DEFAULT_THREAD_POOL_KEEP_ALIVE_TIMEDefault keep alive time in milliseconds for threads inThreadPoolExecutoris 1 minute( 60 * 1000 ms)
-
-
Method Details
-
addListener
Description copied from interface:DynamicConfigurationRegister a configuration listener for a specified key The listener only works for service governance purpose, so the target group would always be the value user specifies at startup or 'dubbo' by default. This method will only register listener, which means it will not trigger a notification that contains the current value.- Specified by:
addListenerin interfaceDynamicConfiguration- Parameters:
key- the key to represent a configurationgroup- the group where the key belongs tolistener- configuration listener
-
removeListener
Description copied from interface:DynamicConfigurationStops one listener from listening to value changes in the specified key.- Specified by:
removeListenerin interfaceDynamicConfiguration- Parameters:
key- the key to represent a configurationgroup- the group where the key belongs tolistener- configuration listener
-
getConfig
Description copied from interface:DynamicConfigurationGet the configuration mapped to the given key and the given group. If the configuration fails to fetch after timeout exceeds, IllegalStateException will be thrown.- Specified by:
getConfigin interfaceDynamicConfiguration- Parameters:
key- the key to represent a configurationgroup- the group where the key belongs totimeout- timeout value for fetching the target config- Returns:
- target configuration mapped to the given key and the given group, IllegalStateException will be thrown if timeout exceeds.
- Throws:
IllegalStateException
-
getInternalProperty
- Specified by:
getInternalPropertyin interfaceConfiguration
-
close
Description copied from interface:DynamicConfigurationClose the configuration- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceDynamicConfiguration- Throws:
Exception
-
removeConfig
- Specified by:
removeConfigin interfaceDynamicConfiguration- Parameters:
key- the key to represent a configurationgroup- the group where the key belongs to- Returns:
trueif success, orfalse
-
getDefaultGroup
Description copied from interface:DynamicConfigurationGet the default group for the operations- Specified by:
getDefaultGroupin interfaceDynamicConfiguration- Returns:
- the default group
- Since:
- 2.7.8
-
getDefaultTimeout
public long getDefaultTimeout()Description copied from interface:DynamicConfigurationGet the default timeout for the operations in milliseconds- Specified by:
getDefaultTimeoutin interfaceDynamicConfiguration- Returns:
- the default timeout
- Since:
- 2.7.8
-