com.huawei.dubbo.registry.service.RegistryConfigServiceImpl Maven / Gradle / Ivy
/*
* Copyright (C) 2021-2022 Huawei Technologies Co., Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.huawei.dubbo.registry.service;
import com.huawei.dubbo.registry.constants.Constant;
import com.huawei.dubbo.registry.utils.CollectionUtils;
import com.huawei.dubbo.registry.utils.ReflectUtils;
import com.huawei.registry.config.RegisterConfig;
import com.huaweicloud.sermant.core.plugin.config.PluginConfigManager;
import java.util.List;
import java.util.Optional;
/**
* 注册配置服务,代码中使用反射调用类方法是为了同时兼容alibaba和apache dubbo
*
* @author provenceee
* @since 2021-12-31
*/
public class RegistryConfigServiceImpl implements RegistryConfigService {
private static final String DUBBO_REGISTRIES_CONFIG_PREFIX = "dubbo.registries.";
private final RegisterConfig config;
/**
* 构造方法
*/
public RegistryConfigServiceImpl() {
config = PluginConfigManager.getPluginConfig(RegisterConfig.class);
}
/**
* 多注册中心注册到sc
*
* @param obj 增强的类
* @see com.alibaba.dubbo.config.AbstractInterfaceConfig
* @see org.apache.dubbo.config.AbstractInterfaceConfig
*/
@Override
public void addRegistryConfig(Object obj) {
if (!config.isOpenMigration() || !config.isEnableDubboRegister()) {
return;
}
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy