Search in sources :

Example 1 with CompositeDynamicConfiguration

use of org.apache.dubbo.common.config.configcenter.wrapper.CompositeDynamicConfiguration in project dubbo by alibaba.

the class DubboBootstrap method startConfigCenter.

private void startConfigCenter() {
    useRegistryAsConfigCenterIfNecessary();
    Collection<ConfigCenterConfig> configCenters = configManager.getConfigCenters();
    // check Config Center
    if (CollectionUtils.isEmpty(configCenters)) {
        ConfigCenterConfig configCenterConfig = new ConfigCenterConfig();
        configCenterConfig.refresh();
        if (configCenterConfig.isValid()) {
            configManager.addConfigCenter(configCenterConfig);
            configCenters = configManager.getConfigCenters();
        }
    } else {
        for (ConfigCenterConfig configCenterConfig : configCenters) {
            configCenterConfig.refresh();
            ConfigValidationUtils.validateConfigCenterConfig(configCenterConfig);
        }
    }
    if (CollectionUtils.isNotEmpty(configCenters)) {
        CompositeDynamicConfiguration compositeDynamicConfiguration = new CompositeDynamicConfiguration();
        for (ConfigCenterConfig configCenter : configCenters) {
            compositeDynamicConfiguration.addConfiguration(prepareEnvironment(configCenter));
        }
        environment.setDynamicConfiguration(compositeDynamicConfiguration);
    }
    configManager.refreshAll();
}
Also used : ConfigCenterConfig(org.apache.dubbo.config.ConfigCenterConfig) CompositeDynamicConfiguration(org.apache.dubbo.common.config.configcenter.wrapper.CompositeDynamicConfiguration)

Aggregations

CompositeDynamicConfiguration (org.apache.dubbo.common.config.configcenter.wrapper.CompositeDynamicConfiguration)1 ConfigCenterConfig (org.apache.dubbo.config.ConfigCenterConfig)1