|
|
@ -188,26 +188,30 @@ public class ServerNodeManager implements InitializingBean { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
// sync worker node info
|
|
|
|
try { |
|
|
|
Map<String, String> newWorkerNodeInfo = registryClient.getServerMaps(NodeType.WORKER, true); |
|
|
|
// sync worker node info
|
|
|
|
syncAllWorkerNodeInfo(newWorkerNodeInfo); |
|
|
|
Map<String, String> newWorkerNodeInfo = registryClient.getServerMaps(NodeType.WORKER, true); |
|
|
|
|
|
|
|
syncAllWorkerNodeInfo(newWorkerNodeInfo); |
|
|
|
// sync worker group nodes from database
|
|
|
|
|
|
|
|
List<WorkerGroup> workerGroupList = workerGroupMapper.queryAllWorkerGroup(); |
|
|
|
// sync worker group nodes from database
|
|
|
|
if (CollectionUtils.isNotEmpty(workerGroupList)) { |
|
|
|
List<WorkerGroup> workerGroupList = workerGroupMapper.queryAllWorkerGroup(); |
|
|
|
for (WorkerGroup wg : workerGroupList) { |
|
|
|
if (CollectionUtils.isNotEmpty(workerGroupList)) { |
|
|
|
String workerGroup = wg.getName(); |
|
|
|
for (WorkerGroup wg : workerGroupList) { |
|
|
|
Set<String> nodes = new HashSet<>(); |
|
|
|
String workerGroup = wg.getName(); |
|
|
|
String[] addrs = wg.getAddrList().split(Constants.COMMA); |
|
|
|
Set<String> nodes = new HashSet<>(); |
|
|
|
for (String addr : addrs) { |
|
|
|
String[] addrs = wg.getAddrList().split(Constants.COMMA); |
|
|
|
if (newWorkerNodeInfo.containsKey(addr)) { |
|
|
|
for (String addr : addrs) { |
|
|
|
nodes.add(addr); |
|
|
|
if (newWorkerNodeInfo.containsKey(addr)) { |
|
|
|
|
|
|
|
nodes.add(addr); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!nodes.isEmpty()) { |
|
|
|
|
|
|
|
syncWorkerGroupNodes(workerGroup, nodes); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!nodes.isEmpty()) { |
|
|
|
|
|
|
|
syncWorkerGroupNodes(workerGroup, nodes); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
logger.error("WorkerNodeInfoAndGroupDbSyncTask error:", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|