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/08/30 02:50:22 UTC

[dubbo] 01/02: Compact old style getApplication

This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.0-multi-instances
in repository https://gitbox.apache.org/repos/asf/dubbo.git

commit cdb9992df3ce46d96572cf33d9d22c45807fff0d
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Mon Aug 30 10:42:49 2021 +0800

    Compact old style getApplication
---
 .../apache/dubbo/rpc/model/ApplicationModel.java   | 25 +++++++++++++++-------
 1 file changed, 17 insertions(+), 8 deletions(-)

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 dca4ba4..6ae46a6 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
@@ -107,20 +107,24 @@ public class ApplicationModel extends ScopeModel {
         return frameworkModel;
     }
 
-    public Collection<ConsumerModel> allConsumerModels() {
-        return getApplicationServiceRepository().getReferredServices();
+    @Deprecated
+    public static Collection<ConsumerModel> allConsumerModels() {
+        return defaultModel().getApplicationServiceRepository().getReferredServices();
     }
 
-    public Collection<ProviderModel> allProviderModels() {
-        return getApplicationServiceRepository().getExportedServices();
+    @Deprecated
+    public static Collection<ProviderModel> allProviderModels() {
+        return defaultModel().getApplicationServiceRepository().getExportedServices();
     }
 
-    public ProviderModel getProviderModel(String serviceKey) {
-        return getApplicationServiceRepository().lookupExportedService(serviceKey);
+    @Deprecated
+    public static ProviderModel getProviderModel(String serviceKey) {
+        return defaultModel().getApplicationServiceRepository().lookupExportedService(serviceKey);
     }
 
-    public ConsumerModel getConsumerModel(String serviceKey) {
-        return getApplicationServiceRepository().lookupReferredService(serviceKey);
+    @Deprecated
+    public static ConsumerModel getConsumerModel(String serviceKey) {
+        return defaultModel().getApplicationServiceRepository().lookupReferredService(serviceKey);
     }
 
     public void initFrameworkExts() {
@@ -192,6 +196,11 @@ public class ApplicationModel extends ScopeModel {
         return defaultModel().getCurrentConfig().getName();
     }
 
+    @Deprecated
+    public static String getApplication() {
+        return getName();
+    }
+
     public String getApplicationName() {
         return getCurrentConfig().getName();
     }