format code

This commit is contained in:
IanCao 2019-06-10 12:23:48 +08:00
parent dd8ee44d65
commit b989e50791
5 changed files with 15 additions and 25 deletions

View File

@ -65,8 +65,7 @@ public class ServerHttpAgent implements HttpAgent {
public HttpResult httpGet(String path, List<String> headers, List<String> paramValues, String encoding,
long readTimeoutMs) throws IOException {
final long endTime = System.currentTimeMillis() + readTimeoutMs;
boolean isSSL = false;
final boolean isSSL = false;
do {
try {

View File

@ -515,8 +515,6 @@ public class ClientWorker {
}
}
// =================
public boolean isHealthServer() {
return isHealthServer;
}
@ -525,16 +523,16 @@ public class ClientWorker {
this.isHealthServer = isHealthServer;
}
final ScheduledExecutorService executor;
final ExecutorService executorService;
private final ScheduledExecutorService executor;
private final ExecutorService executorService;
/**
* 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>());
HttpAgent agent;
ConfigFilterChainManager configFilterChainManager;
private final HttpAgent agent;
private final ConfigFilterChainManager configFilterChainManager;
private boolean isHealthServer = true;
private double currentLongingTaskCount = 0;
}

View File

@ -53,6 +53,8 @@ import java.util.concurrent.Callable;
*/
@SuppressWarnings("PMD.ServiceOrDaoClassShouldEndWithImplRule")
public class NacosNamingService implements NamingService {
private static final String DEFAULT_PORT = "8080";
/**
* Each Naming instance should have different namespace.
*/
@ -82,7 +84,6 @@ public class NacosNamingService implements NamingService {
}
public NacosNamingService(Properties properties) {
init(properties);
}
@ -151,7 +152,6 @@ public class NacosNamingService implements NamingService {
private void initEndpoint(final Properties properties) {
if (properties == null) {
return;
}
//这里通过 dubbo/sca 侧来初始化默认传入的是 true
@ -159,7 +159,7 @@ public class NacosNamingService implements NamingService {
String endpointUrl;
if (isUseEndpointParsingRule) {
endpointUrl = ParamUtil.parsingEndpointRule(properties.getProperty(PropertyKeyConst.ENDPOINT));
if (com.alibaba.nacos.client.utils.StringUtils.isNotBlank(endpointUrl)) {
if (StringUtils.isNotBlank(endpointUrl)) {
serverList = "";
}
} else {
@ -181,7 +181,7 @@ public class NacosNamingService implements NamingService {
endpointPort = TemplateUtils.stringEmptyAndThenExecute(endpointPort, new Callable<String>() {
@Override
public String call() {
return "8080";
return DEFAULT_PORT;
}
});

View File

@ -86,22 +86,16 @@ public class EnvUtil {
return selfLocationTag;
}
public static String listToString(List<String> list) {
if (list == null) {
private static String listToString(List<String> list) {
if (list == null || list.isEmpty()) {
return null;
}
StringBuilder result = new StringBuilder();
boolean first = true;
// 第一个前面不拼接","
for (String string : list) {
if (first) {
first = false;
} else {
result.append(",");
}
result.append(",");
result.append(string);
}
return result.toString();
return result.toString().substring(0, result.length() - 1);
}
private static String selfAmorayTag;

View File

@ -32,7 +32,7 @@ public class StringUtils {
return true;
}
for (int i = 0; i < strLen; i++) {
if ((Character.isWhitespace(str.charAt(i)) == false)) {
if (!Character.isWhitespace(str.charAt(i))) {
return false;
}
}
@ -40,7 +40,6 @@ public class StringUtils {
}
public static boolean isNotBlank(String str) {
return !isBlank(str);
}