Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nkorange committed Nov 19, 2018
1 parent d42e8ac commit 3a6eafc
Showing 1 changed file with 3 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import com.alibaba.nacos.common.util.SystemUtils;
import com.alibaba.nacos.naming.boot.RunningConfig;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

Expand All @@ -30,9 +29,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;

import static com.alibaba.nacos.common.util.SystemUtils.CLUSTER_CONF_FILE_PATH;
import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.common.util.SystemUtils.readClusterConf;
import static com.alibaba.nacos.common.util.SystemUtils.*;

/**
* @author nacos
Expand Down Expand Up @@ -99,10 +96,6 @@ public static List<String> getServers() {
}

public static void refreshSrvIfNeed() {
refreshSrvIfNeed(StringUtils.EMPTY);
}

public static void refreshSrvIfNeed(String env) {
try {
if (System.currentTimeMillis() - lastSrvRefTime < VIP_SRV_REF_INTER_MILLIS) {
return;
Expand All @@ -116,24 +109,12 @@ public static void refreshSrvIfNeed(String env) {

List<String> serverlist = refreshServerListFromDisk();

List<String> list = new ArrayList<String>();
if (!CollectionUtils.isEmpty(serverlist)) {
serverlistFromConfig = serverlist;
if (list.isEmpty()) {
Loggers.SRV_LOG.warn("Can not acquire server list");
}
}


if (!StringUtils.isEmpty(env)) {
serverListMap.put(env, list);
} else {
if (!CollectionUtils.isEqualCollection(serverlistFromConfig, list) && CollectionUtils.isNotEmpty(serverlistFromConfig)) {
Loggers.SRV_LOG.info("[SERVER-LIST] server list is not the same between AS and config file, use config file.");
servers = serverlistFromConfig;
} else {
servers = list;
}
if (!CollectionUtils.isEqualCollection(serverlistFromConfig, servers) && CollectionUtils.isNotEmpty(serverlistFromConfig)) {
servers = serverlistFromConfig;
}

if (RunningConfig.getServerPort() > 0) {
Expand Down

0 comments on commit 3a6eafc

Please sign in to comment.