You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by bu...@apache.org on 2022/09/07 09:35:46 UTC

[dubbo] branch 3.1 updated: Get the corresponding SPI instance from scopeModel

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

burningcn pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.1 by this push:
     new 4316ff8e2a Get the corresponding SPI instance from scopeModel
4316ff8e2a is described below

commit 4316ff8e2ad566d906a3cd84fab541ea113a9721
Author: 灼华 <10...@qq.com>
AuthorDate: Wed Sep 7 17:35:38 2022 +0800

    Get the corresponding SPI instance from scopeModel
---
 .../dubbo/remoting/telnet/support/command/StatusTelnetHandler.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/support/command/StatusTelnetHandler.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/support/command/StatusTelnetHandler.java
index 8d4676770a..946362e85e 100644
--- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/support/command/StatusTelnetHandler.java
+++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/support/command/StatusTelnetHandler.java
@@ -27,6 +27,8 @@ import org.apache.dubbo.remoting.Channel;
 import org.apache.dubbo.remoting.telnet.TelnetHandler;
 import org.apache.dubbo.remoting.telnet.support.Help;
 import org.apache.dubbo.remoting.telnet.support.TelnetUtils;
+import org.apache.dubbo.rpc.model.ApplicationModel;
+import org.apache.dubbo.rpc.model.ScopeModelUtil;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -43,10 +45,10 @@ import static org.apache.dubbo.config.Constants.STATUS_KEY;
 @Help(parameter = "[-l]", summary = "Show status.", detail = "Show status.")
 public class StatusTelnetHandler implements TelnetHandler {
 
-    private final ExtensionLoader<StatusChecker> extensionLoader = ExtensionLoader.getExtensionLoader(StatusChecker.class);
-
     @Override
     public String telnet(Channel channel, String message) {
+        ApplicationModel applicationModel = ScopeModelUtil.getApplicationModel(channel.getUrl().getScopeModel());
+        ExtensionLoader<StatusChecker> extensionLoader = applicationModel.getExtensionLoader(StatusChecker.class);
         if ("-l".equals(message)) {
             List<StatusChecker> checkers = extensionLoader.getActivateExtension(channel.getUrl(), STATUS_KEY);
             String[] header = new String[]{"resource", "status", "message"};