format code
This commit is contained in:
parent
dd8ee44d65
commit
b989e50791
@ -65,8 +65,7 @@ public class ServerHttpAgent implements HttpAgent {
|
|||||||
public HttpResult httpGet(String path, List<String> headers, List<String> paramValues, String encoding,
|
public HttpResult httpGet(String path, List<String> headers, List<String> paramValues, String encoding,
|
||||||
long readTimeoutMs) throws IOException {
|
long readTimeoutMs) throws IOException {
|
||||||
final long endTime = System.currentTimeMillis() + readTimeoutMs;
|
final long endTime = System.currentTimeMillis() + readTimeoutMs;
|
||||||
|
final boolean isSSL = false;
|
||||||
boolean isSSL = false;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try {
|
try {
|
||||||
|
@ -515,8 +515,6 @@ public class ClientWorker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// =================
|
|
||||||
|
|
||||||
public boolean isHealthServer() {
|
public boolean isHealthServer() {
|
||||||
return isHealthServer;
|
return isHealthServer;
|
||||||
}
|
}
|
||||||
@ -525,16 +523,16 @@ public class ClientWorker {
|
|||||||
this.isHealthServer = isHealthServer;
|
this.isHealthServer = isHealthServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ScheduledExecutorService executor;
|
private final ScheduledExecutorService executor;
|
||||||
final ExecutorService executorService;
|
private final ExecutorService executorService;
|
||||||
/**
|
/**
|
||||||
* groupKey -> cacheData
|
* groupKey -> cacheData
|
||||||
*/
|
*/
|
||||||
AtomicReference<Map<String, CacheData>> cacheMap = new AtomicReference<Map<String, CacheData>>(
|
private final AtomicReference<Map<String, CacheData>> cacheMap = new AtomicReference<Map<String, CacheData>>(
|
||||||
new HashMap<String, CacheData>());
|
new HashMap<String, CacheData>());
|
||||||
|
|
||||||
HttpAgent agent;
|
private final HttpAgent agent;
|
||||||
ConfigFilterChainManager configFilterChainManager;
|
private final ConfigFilterChainManager configFilterChainManager;
|
||||||
private boolean isHealthServer = true;
|
private boolean isHealthServer = true;
|
||||||
private double currentLongingTaskCount = 0;
|
private double currentLongingTaskCount = 0;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,8 @@ import java.util.concurrent.Callable;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("PMD.ServiceOrDaoClassShouldEndWithImplRule")
|
@SuppressWarnings("PMD.ServiceOrDaoClassShouldEndWithImplRule")
|
||||||
public class NacosNamingService implements NamingService {
|
public class NacosNamingService implements NamingService {
|
||||||
|
private static final String DEFAULT_PORT = "8080";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Each Naming instance should have different namespace.
|
* Each Naming instance should have different namespace.
|
||||||
*/
|
*/
|
||||||
@ -82,7 +84,6 @@ public class NacosNamingService implements NamingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public NacosNamingService(Properties properties) {
|
public NacosNamingService(Properties properties) {
|
||||||
|
|
||||||
init(properties);
|
init(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +152,6 @@ public class NacosNamingService implements NamingService {
|
|||||||
|
|
||||||
private void initEndpoint(final Properties properties) {
|
private void initEndpoint(final Properties properties) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//这里通过 dubbo/sca 侧来初始化默认传入的是 true
|
//这里通过 dubbo/sca 侧来初始化默认传入的是 true
|
||||||
@ -159,7 +159,7 @@ public class NacosNamingService implements NamingService {
|
|||||||
String endpointUrl;
|
String endpointUrl;
|
||||||
if (isUseEndpointParsingRule) {
|
if (isUseEndpointParsingRule) {
|
||||||
endpointUrl = ParamUtil.parsingEndpointRule(properties.getProperty(PropertyKeyConst.ENDPOINT));
|
endpointUrl = ParamUtil.parsingEndpointRule(properties.getProperty(PropertyKeyConst.ENDPOINT));
|
||||||
if (com.alibaba.nacos.client.utils.StringUtils.isNotBlank(endpointUrl)) {
|
if (StringUtils.isNotBlank(endpointUrl)) {
|
||||||
serverList = "";
|
serverList = "";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -181,7 +181,7 @@ public class NacosNamingService implements NamingService {
|
|||||||
endpointPort = TemplateUtils.stringEmptyAndThenExecute(endpointPort, new Callable<String>() {
|
endpointPort = TemplateUtils.stringEmptyAndThenExecute(endpointPort, new Callable<String>() {
|
||||||
@Override
|
@Override
|
||||||
public String call() {
|
public String call() {
|
||||||
return "8080";
|
return DEFAULT_PORT;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -86,22 +86,16 @@ public class EnvUtil {
|
|||||||
return selfLocationTag;
|
return selfLocationTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String listToString(List<String> list) {
|
private static String listToString(List<String> list) {
|
||||||
if (list == null) {
|
if (list == null || list.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
boolean first = true;
|
|
||||||
// 第一个前面不拼接","
|
|
||||||
for (String string : list) {
|
for (String string : list) {
|
||||||
if (first) {
|
|
||||||
first = false;
|
|
||||||
} else {
|
|
||||||
result.append(",");
|
result.append(",");
|
||||||
}
|
|
||||||
result.append(string);
|
result.append(string);
|
||||||
}
|
}
|
||||||
return result.toString();
|
return result.toString().substring(0, result.length() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String selfAmorayTag;
|
private static String selfAmorayTag;
|
||||||
|
@ -32,7 +32,7 @@ public class StringUtils {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < strLen; i++) {
|
for (int i = 0; i < strLen; i++) {
|
||||||
if ((Character.isWhitespace(str.charAt(i)) == false)) {
|
if (!Character.isWhitespace(str.charAt(i))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,7 +40,6 @@ public class StringUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNotBlank(String str) {
|
public static boolean isNotBlank(String str) {
|
||||||
|
|
||||||
return !isBlank(str);
|
return !isBlank(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user