add try catch (#8433)
This commit is contained in:
parent
668b36c731
commit
8200a3f15a
|
|
@ -188,26 +188,30 @@ public class ServerNodeManager implements InitializingBean {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
// sync worker node info
|
||||
Map<String, String> newWorkerNodeInfo = registryClient.getServerMaps(NodeType.WORKER, true);
|
||||
syncAllWorkerNodeInfo(newWorkerNodeInfo);
|
||||
try {
|
||||
// sync worker node info
|
||||
Map<String, String> newWorkerNodeInfo = registryClient.getServerMaps(NodeType.WORKER, true);
|
||||
syncAllWorkerNodeInfo(newWorkerNodeInfo);
|
||||
|
||||
// sync worker group nodes from database
|
||||
List<WorkerGroup> workerGroupList = workerGroupMapper.queryAllWorkerGroup();
|
||||
if (CollectionUtils.isNotEmpty(workerGroupList)) {
|
||||
for (WorkerGroup wg : workerGroupList) {
|
||||
String workerGroup = wg.getName();
|
||||
Set<String> nodes = new HashSet<>();
|
||||
String[] addrs = wg.getAddrList().split(Constants.COMMA);
|
||||
for (String addr : addrs) {
|
||||
if (newWorkerNodeInfo.containsKey(addr)) {
|
||||
nodes.add(addr);
|
||||
// sync worker group nodes from database
|
||||
List<WorkerGroup> workerGroupList = workerGroupMapper.queryAllWorkerGroup();
|
||||
if (CollectionUtils.isNotEmpty(workerGroupList)) {
|
||||
for (WorkerGroup wg : workerGroupList) {
|
||||
String workerGroup = wg.getName();
|
||||
Set<String> nodes = new HashSet<>();
|
||||
String[] addrs = wg.getAddrList().split(Constants.COMMA);
|
||||
for (String addr : addrs) {
|
||||
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…
Reference in New Issue