Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize StatusTelnetHandler code and extract constants #8041

Merged
merged 1 commit into from Jun 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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