You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/10/19 02:24:35 UTC
[dubbo] branch 3.0 updated: Add Deprecated description (#9065)
This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0 by this push:
new d7f600e Add Deprecated description (#9065)
d7f600e is described below
commit d7f600e2392643c63506dd4480f9080556a2dc16
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Tue Oct 19 10:24:18 2021 +0800
Add Deprecated description (#9065)
---
.../dubbo/common/config/ConfigurationUtils.java | 37 +++++++++++++++++++
.../apache/dubbo/common/config/Environment.java | 3 ++
.../config/OrderedPropertiesConfiguration.java | 3 ++
.../common/config/configcenter/Constants.java | 3 ++
.../dubbo/config/AbstractInterfaceConfig.java | 27 ++++++++++++++
.../dubbo/config/AbstractReferenceConfig.java | 6 ++++
.../apache/dubbo/rpc/model/ApplicationModel.java | 42 ++++++++++++++++++++++
.../dubbo/rpc/model/ModuleServiceRepository.java | 11 ++++--
8 files changed, 130 insertions(+), 2 deletions(-)
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/config/ConfigurationUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/config/ConfigurationUtils.java
index 7b3576d..071e7db 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/config/ConfigurationUtils.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/config/ConfigurationUtils.java
@@ -326,52 +326,89 @@ public class ConfigurationUtils {
/**
* For compact single instance
+ * @deprecated Replaced to {@link ConfigurationUtils#getSystemConfiguration(ScopeModel)}
*/
@Deprecated
public static Configuration getSystemConfiguration() {
return ApplicationModel.defaultModel().getModelEnvironment().getSystemConfiguration();
}
+ /**
+ * For compact single instance
+ * @deprecated Replaced to {@link ConfigurationUtils#getEnvConfiguration(ScopeModel)}
+ */
@Deprecated
public static Configuration getEnvConfiguration() {
return ApplicationModel.defaultModel().getModelEnvironment().getEnvironmentConfiguration();
}
+ /**
+ * For compact single instance
+ * @deprecated Replaced to {@link ConfigurationUtils#getGlobalConfiguration(ScopeModel)}
+ */
@Deprecated
public static Configuration getGlobalConfiguration() {
return ApplicationModel.defaultModel().getModelEnvironment().getConfiguration();
}
+ /**
+ * For compact single instance
+ * @deprecated Replaced to {@link ConfigurationUtils#getDynamicGlobalConfiguration(ScopeModel)}
+ */
@Deprecated
public static Configuration getDynamicGlobalConfiguration() {
return ApplicationModel.defaultModel().getDefaultModule().getModelEnvironment().getDynamicGlobalConfiguration();
}
+ /**
+ * For compact single instance
+ * @deprecated Replaced to {@link ConfigurationUtils#getCachedDynamicProperty(ScopeModel, String, String)}
+ */
@Deprecated
public static String getCachedDynamicProperty(String key, String defaultValue) {
return getCachedDynamicProperty(ApplicationModel.defaultModel(), key, defaultValue);
}
+ /**
+ * For compact single instance
+ * @deprecated Replaced to {@link ConfigurationUtils#getDynamicProperty(ScopeModel, String)}
+ */
@Deprecated
public static String getDynamicProperty(String property) {
return getDynamicProperty(ApplicationModel.defaultModel(), property);
}
+ /**
+ * For compact single instance
+ * @deprecated Replaced to {@link ConfigurationUtils#getDynamicProperty(ScopeModel, String, String)}
+ */
@Deprecated
public static String getDynamicProperty(String property, String defaultValue) {
return getDynamicProperty(ApplicationModel.defaultModel(), property, defaultValue);
}
+ /**
+ * For compact single instance
+ * @deprecated Replaced to {@link ConfigurationUtils#getProperty(ScopeModel, String)}
+ */
@Deprecated
public static String getProperty(String property) {
return getProperty(ApplicationModel.defaultModel(), property);
}
+ /**
+ * For compact single instance
+ * @deprecated Replaced to {@link ConfigurationUtils#getProperty(ScopeModel, String, String)}
+ */
@Deprecated
public static String getProperty(String property, String defaultValue) {
return getProperty(ApplicationModel.defaultModel(), property, defaultValue);
}
+ /**
+ * For compact single instance
+ * @deprecated Replaced to {@link ConfigurationUtils#get(ScopeModel, String, int)}
+ */
@Deprecated
public static int get(String property, int defaultValue) {
return get(ApplicationModel.defaultModel(), property, defaultValue);
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java b/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
index 67ecf61..d5dd632 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
@@ -99,6 +99,9 @@ public class Environment extends LifecycleAdapter implements ApplicationExt {
this.localMigrationRule = ConfigUtils.loadMigrationRule(scopeModel.getClassLoaders(), path);
}
+ /**
+ * @deprecated only for ut
+ */
@Deprecated
public void setLocalMigrationRule(String localMigrationRule) {
this.localMigrationRule = localMigrationRule;
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/config/OrderedPropertiesConfiguration.java b/dubbo-common/src/main/java/org/apache/dubbo/common/config/OrderedPropertiesConfiguration.java
index 299ec2b..734eda5 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/config/OrderedPropertiesConfiguration.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/config/OrderedPropertiesConfiguration.java
@@ -78,6 +78,9 @@ public class OrderedPropertiesConfiguration implements Configuration{
return (String) properties.remove(key);
}
+ /**
+ * For ut only
+ */
@Deprecated
public void setProperties(Properties properties) {
this.properties = properties;
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/config/configcenter/Constants.java b/dubbo-common/src/main/java/org/apache/dubbo/common/config/configcenter/Constants.java
index c0a5d9e..9279c65 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/config/configcenter/Constants.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/config/configcenter/Constants.java
@@ -16,6 +16,9 @@
*/
package org.apache.dubbo.common.config.configcenter;
+/**
+ * @deprecated Replaced to {@link org.apache.dubbo.common.constants.CommonConstants}
+ */
@Deprecated
public interface Constants {
String CONFIG_CLUSTER_KEY = "config.cluster";
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
index edf769c..7a75205 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
@@ -27,6 +27,7 @@ import org.apache.dubbo.common.utils.CollectionUtils;
import org.apache.dubbo.common.utils.ConfigUtils;
import org.apache.dubbo.common.utils.ReflectUtils;
import org.apache.dubbo.common.utils.StringUtils;
+import org.apache.dubbo.config.context.ConfigManager;
import org.apache.dubbo.config.support.Parameter;
import org.apache.dubbo.rpc.model.ApplicationModel;
import org.apache.dubbo.rpc.model.ScopeModel;
@@ -624,6 +625,10 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {
return getConfigManager().getApplicationOrElseThrow();
}
+ /**
+ * @deprecated Use {@link AbstractInterfaceConfig#setScopeModel(ScopeModel)}
+ * @param application
+ */
@Deprecated
public void setApplication(ApplicationConfig application) {
this.application = application;
@@ -639,6 +644,10 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {
return getModuleConfigManager().getModule().orElse(null);
}
+ /**
+ * @deprecated Use {@link AbstractInterfaceConfig#setScopeModel(ScopeModel)}
+ * @param module
+ */
@Deprecated
public void setModule(ModuleConfig module) {
this.module = module;
@@ -700,11 +709,17 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {
return getConfigManager().getMonitor().orElse(null);
}
+ /**
+ * @deprecated Use {@link org.apache.dubbo.config.context.ConfigManager#setMonitor(MonitorConfig)}
+ */
@Deprecated
public void setMonitor(String monitor) {
setMonitor(new MonitorConfig(monitor));
}
+ /**
+ * @deprecated Use {@link org.apache.dubbo.config.context.ConfigManager#setMonitor(MonitorConfig)}
+ */
@Deprecated
public void setMonitor(MonitorConfig monitor) {
this.monitor = monitor;
@@ -721,6 +736,9 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {
this.owner = owner;
}
+ /**
+ * @deprecated Use {@link org.apache.dubbo.config.context.ConfigManager#getConfigCenter(String)}
+ */
@Deprecated
public ConfigCenterConfig getConfigCenter() {
if (configCenter != null) {
@@ -733,6 +751,9 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {
return null;
}
+ /**
+ * @deprecated Use {@link org.apache.dubbo.config.context.ConfigManager#addConfigCenter(ConfigCenterConfig)}
+ */
@Deprecated
public void setConfigCenter(ConfigCenterConfig configCenter) {
this.configCenter = configCenter;
@@ -773,6 +794,9 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {
this.scope = scope;
}
+ /**
+ * @deprecated Use {@link ConfigManager#getMetadataConfigs()}
+ */
@Deprecated
public MetadataReportConfig getMetadataReportConfig() {
if (metadataReportConfig != null) {
@@ -785,6 +809,9 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {
return null;
}
+ /**
+ * @deprecated Use {@link ConfigManager#addMetadataReport(MetadataReportConfig)}
+ */
@Deprecated
public void setMetadataReportConfig(MetadataReportConfig metadataReportConfig) {
this.metadataReportConfig = metadataReportConfig;
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractReferenceConfig.java b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractReferenceConfig.java
index e243262..deb358b 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractReferenceConfig.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractReferenceConfig.java
@@ -113,12 +113,18 @@ public abstract class AbstractReferenceConfig extends AbstractInterfaceConfig {
this.init = init;
}
+ /**
+ * @deprecated Replace to {@link AbstractReferenceConfig#getGeneric()}
+ */
@Deprecated
@Parameter(excluded = true, attribute = false)
public Boolean isGeneric() {
return this.generic != null ? ProtocolUtils.isGeneric(generic) : null;
}
+ /**
+ * @deprecated Replace to {@link AbstractReferenceConfig#setGeneric(String)}
+ */
@Deprecated
public void setGeneric(Boolean generic) {
if (generic != null) {
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ApplicationModel.java b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ApplicationModel.java
index 8fd6f0c..e5f1e82 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ApplicationModel.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ApplicationModel.java
@@ -94,56 +94,89 @@ public class ApplicationModel extends ScopeModel {
return defaultInstance;
}
+ /**
+ * @deprecated use {@link ServiceRepository#allConsumerModels()}
+ */
@Deprecated
public static Collection<ConsumerModel> allConsumerModels() {
return defaultModel().getApplicationServiceRepository().allConsumerModels();
}
+ /**
+ * @deprecated use {@link ServiceRepository#allProviderModels()}
+ */
@Deprecated
public static Collection<ProviderModel> allProviderModels() {
return defaultModel().getApplicationServiceRepository().allProviderModels();
}
+ /**
+ * @deprecated use {@link FrameworkServiceRepository#lookupExportedService(String)}
+ */
@Deprecated
public static ProviderModel getProviderModel(String serviceKey) {
return defaultModel().getDefaultModule().getServiceRepository().lookupExportedService(serviceKey);
}
+ /**
+ * @deprecated ConsumerModel should fetch from context
+ */
@Deprecated
public static ConsumerModel getConsumerModel(String serviceKey) {
return defaultModel().getDefaultModule().getServiceRepository().lookupReferredService(serviceKey);
}
+ /**
+ * @deprecated Replace to {@link ScopeModel#getModelEnvironment()}
+ */
@Deprecated
public static Environment getEnvironment() {
return defaultModel().getModelEnvironment();
}
+ /**
+ * @deprecated Replace to {@link ApplicationModel#getApplicationConfigManager()}
+ */
@Deprecated
public static ConfigManager getConfigManager() {
return defaultModel().getApplicationConfigManager();
}
+ /**
+ * @deprecated Replace to {@link ApplicationModel#getApplicationServiceRepository()}
+ */
@Deprecated
public static ServiceRepository getServiceRepository() {
return defaultModel().getApplicationServiceRepository();
}
+ /**
+ * @deprecated Replace to {@link ApplicationModel#getApplicationExecutorRepository()}
+ */
@Deprecated
public static ExecutorRepository getExecutorRepository() {
return defaultModel().getApplicationExecutorRepository();
}
+ /**
+ * @deprecated Replace to {@link ApplicationModel#getCurrentConfig()}
+ */
@Deprecated
public static ApplicationConfig getApplicationConfig() {
return defaultModel().getCurrentConfig();
}
+ /**
+ * @deprecated Replace to {@link ApplicationModel#getApplicationName()}
+ */
@Deprecated
public static String getName() {
return defaultModel().getCurrentConfig().getName();
}
+ /**
+ * @deprecated Replace to {@link ApplicationModel#getApplicationName()}
+ */
@Deprecated
public static String getApplication() {
return getName();
@@ -360,16 +393,25 @@ public class ApplicationModel extends ScopeModel {
return internalModule;
}
+ /**
+ * @deprecated only for ut
+ */
@Deprecated
public void setEnvironment(Environment environment) {
this.environment = environment;
}
+ /**
+ * @deprecated only for ut
+ */
@Deprecated
public void setConfigManager(ConfigManager configManager) {
this.configManager = configManager;
}
+ /**
+ * @deprecated only for ut
+ */
@Deprecated
public void setServiceRepository(ServiceRepository serviceRepository) {
this.serviceRepository = serviceRepository;
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModuleServiceRepository.java b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModuleServiceRepository.java
index af1e13b..eae0fb0 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModuleServiceRepository.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModuleServiceRepository.java
@@ -56,6 +56,9 @@ public class ModuleServiceRepository {
return moduleModel;
}
+ /**
+ * @deprecated Replaced to {@link ModuleServiceRepository#registerConsumer(ConsumerModel)}
+ */
@Deprecated
public void registerConsumer(String serviceKey,
ServiceDescriptor serviceDescriptor,
@@ -71,6 +74,9 @@ public class ModuleServiceRepository {
consumers.computeIfAbsent(consumerModel.getServiceKey(), (serviceKey) -> new CopyOnWriteArrayList<>()).add(consumerModel);
}
+ /**
+ * @deprecated Replaced to {@link ModuleServiceRepository#registerProvider(ProviderModel)}
+ */
@Deprecated
public void registerProvider(String serviceKey,
Object serviceInstance,
@@ -200,7 +206,6 @@ public class ModuleServiceRepository {
return Collections.unmodifiableList(new ArrayList<>(providers.values()));
}
- @Deprecated
public ProviderModel lookupExportedService(String serviceKey) {
return providers.get(serviceKey);
}
@@ -210,6 +215,9 @@ public class ModuleServiceRepository {
return Collections.unmodifiableList(consumerModels);
}
+ /**
+ * @deprecated Replaced to {@link ModuleServiceRepository#lookupReferredServices(String)}
+ */
@Deprecated
public ConsumerModel lookupReferredService(String serviceKey) {
if (consumers.containsKey(serviceKey)) {
@@ -220,7 +228,6 @@ public class ModuleServiceRepository {
}
}
- @Deprecated
public List<ConsumerModel> lookupReferredServices(String serviceKey) {
return consumers.get(serviceKey);
}