Browse Source

add try catch (#8433)

3.0.0/version-upgrade
xiangzihao 3 years ago committed by GitHub
parent
commit
8200a3f15a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 38
      dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java

38
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java

@ -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);
} }
} }
} }

Loading…
Cancel
Save