Skip to content

Commit

Permalink
Optimize StatusTelnetHandler code and extract constants (#8041)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoheng1 committed Jun 15, 2021
1 parent cfe3bab commit 8892a36
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -34,6 +34,7 @@
import java.util.Map;

import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATTERN;
import static org.apache.dubbo.config.Constants.STATUS_KEY;

/**
* StatusTelnetHandler
Expand All @@ -47,7 +48,7 @@ public class StatusTelnetHandler implements TelnetHandler {
@Override
public String telnet(Channel channel, String message) {
if ("-l".equals(message)) {
List<StatusChecker> checkers = extensionLoader.getActivateExtension(channel.getUrl(), "status");
List<StatusChecker> checkers = extensionLoader.getActivateExtension(channel.getUrl(), STATUS_KEY);
String[] header = new String[]{"resource", "status", "message"};
List<List<String>> table = new ArrayList<List<String>>();
Map<String, Status> statuses = new HashMap<String, Status>();
Expand Down Expand Up @@ -80,7 +81,7 @@ public String telnet(Channel channel, String message) {
} else if (message.length() > 0) {
return "Unsupported parameter " + message + " for status.";
}
String status = channel.getUrl().getParameter("status");
String status = channel.getUrl().getParameter(STATUS_KEY);
Map<String, Status> statuses = new HashMap<String, Status>();
if (StringUtils.isNotEmpty(status)) {
String[] ss = COMMA_SPLIT_PATTERN.split(status);
Expand Down

0 comments on commit 8892a36

Please sign in to comment.