Class CompositeDynamicConfiguration
java.lang.Object
org.apache.dubbo.common.config.configcenter.wrapper.CompositeDynamicConfiguration
- All Implemented Interfaces:
AutoCloseable,DynamicConfiguration,Configuration
support multiple config center, simply iterating each concrete config center.
-
Field Summary
FieldsFields inherited from interface org.apache.dubbo.common.config.Configuration
interfaceLevelLoggerFields inherited from interface org.apache.dubbo.common.config.configcenter.DynamicConfiguration
DEFAULT_GROUP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConfiguration(DynamicConfiguration configuration) voidaddListener(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.voidclose()Close the configurationGet the configuration mapped to the given key and the given group.getProperties(String key, String group, long timeout) This method are mostly used to get a compound config file, such as a complete dubbo.properties file.booleanpublishConfig(String key, String group, String content) Publish Config mapped to the given key and the given 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, getDefaultGroup, getDefaultTimeout, getProperties, publishConfig, publishConfigCas, removeConfig, removeListener
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
CompositeDynamicConfiguration
public CompositeDynamicConfiguration()
-
-
Method Details
-
addConfiguration
-
getInnerConfigurations
-
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
-
getProperties
Description copied from interface:DynamicConfigurationThis method are mostly used to get a compound config file, such as a complete dubbo.properties file.- Specified by:
getPropertiesin interfaceDynamicConfiguration- Throws:
IllegalStateException
-
getInternalProperty
- Specified by:
getInternalPropertyin interfaceConfiguration
-
publishConfig
public boolean publishConfig(String key, String group, String content) throws UnsupportedOperationException Description copied from interface:DynamicConfigurationPublish Config mapped to the given key and the given group.- Specified by:
publishConfigin interfaceDynamicConfiguration- Parameters:
key- the key to represent a configurationgroup- the group where the key belongs tocontent- the content of configuration- Returns:
trueif success, orfalse- Throws:
UnsupportedOperationException- If the under layer does not support
-
close
Description copied from interface:DynamicConfigurationClose the configuration- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceDynamicConfiguration- Throws:
Exception
-