#1344 移动常量位置

This commit is contained in:
rushsky518 2019-06-25 16:10:47 +08:00
parent 88c3ad0c53
commit f0553afa7b
4 changed files with 11 additions and 8 deletions

View File

@ -40,6 +40,8 @@ import java.util.concurrent.TimeUnit;
public class ServerListManager {
private static final Logger LOGGER = LogUtils.logger(ServerListManager.class);
private static final String HTTPS = "https://";
private static final String HTTP = "http://";
public ServerListManager() {
isFixed = false;
@ -120,14 +122,14 @@ public class ServerListManager {
List<String> serverAddrs = new ArrayList<String>();
String[] serverAddrsArr = serverAddrsStr.split(",");
for (String serverAddr: serverAddrsArr) {
if (serverAddr.startsWith(Constants.HTTPS) || serverAddr.startsWith(Constants.HTTP)) {
if (serverAddr.startsWith(HTTPS) || serverAddr.startsWith(HTTP)) {
serverAddrs.add(serverAddr);
} else {
String[] serverAddrArr = serverAddr.split(":");
if (serverAddrArr.length == 1) {
serverAddrs.add(Constants.HTTP + serverAddrArr[0] + ":" + ParamUtil.getDefaultServerPort());
serverAddrs.add(HTTP + serverAddrArr[0] + ":" + ParamUtil.getDefaultServerPort());
} else {
serverAddrs.add(Constants.HTTP + serverAddr);
serverAddrs.add(HTTP + serverAddr);
}
}
}

View File

@ -49,8 +49,4 @@ public class Constants {
public static final String NO_APP_NAME = "";
public static final String HTTP = "http://";
public static final String HTTPS = "https://";
}

View File

@ -398,7 +398,7 @@ public class NamingProxy {
List<String> headers = builderHeaders();
String url;
if (curServer.startsWith(Constants.HTTPS) || curServer.startsWith(Constants.HTTP)) {
if (curServer.startsWith(UtilAndComs.HTTPS) || curServer.startsWith(UtilAndComs.HTTP)) {
url = curServer + api;
} else {
if (!curServer.contains(UtilAndComs.SERVER_ADDR_IP_SPLITER)) {

View File

@ -55,4 +55,9 @@ public class UtilAndComs {
public static final int DEFAULT_POLLING_THREAD_COUNT = Runtime.getRuntime()
.availableProcessors() > 1 ? Runtime.getRuntime().availableProcessors() / 2
: 1;
public static final String HTTP = "http://";
public static final String HTTPS = "https://";
}