[Fix] In updateWorkerNodes method, the workerNodeInfoWriteLock should be used. #15898 (#15903)

Co-authored-by: answerliao <answerliao@tencent.com>
This commit is contained in:
DaqianLiao 2024-04-26 11:24:05 +08:00 committed by GitHub
parent d1135eabc7
commit b29965bdce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -245,7 +245,7 @@ public class ServerNodeManager implements InitializingBean {
} }
private void updateWorkerNodes() { private void updateWorkerNodes() {
workerGroupWriteLock.lock(); workerNodeInfoWriteLock.lock();
try { try {
Map<String, String> workerNodeMaps = registryClient.getServerMaps(RegistryNodeType.WORKER); Map<String, String> workerNodeMaps = registryClient.getServerMaps(RegistryNodeType.WORKER);
for (Map.Entry<String, String> entry : workerNodeMaps.entrySet()) { for (Map.Entry<String, String> entry : workerNodeMaps.entrySet()) {
@ -254,7 +254,7 @@ public class ServerNodeManager implements InitializingBean {
workerNodeInfo.put(nodeAddress, workerHeartBeat); workerNodeInfo.put(nodeAddress, workerHeartBeat);
} }
} finally { } finally {
workerGroupWriteLock.unlock(); workerNodeInfoWriteLock.unlock();
} }
} }