mirror of
https://github.com/apache/lucene.git
synced 2025-03-04 07:19:18 +00:00
protect access with sync
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1292093 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2a13b648fa
commit
075b60307e
@ -494,9 +494,9 @@ public class Overseer implements NodeStateChangeListener, ShardLeaderListener {
|
|||||||
try {
|
try {
|
||||||
List<String> liveNodes = zkClient.getChildren(
|
List<String> liveNodes = zkClient.getChildren(
|
||||||
ZkStateReader.LIVE_NODES_ZKNODE, this, true);
|
ZkStateReader.LIVE_NODES_ZKNODE, this, true);
|
||||||
Set<String> liveNodesSet = new HashSet<String>();
|
synchronized (nodeStateWatches) {
|
||||||
liveNodesSet.addAll(liveNodes);
|
processLiveNodesChanged(nodeStateWatches.keySet(), liveNodes);
|
||||||
processLiveNodesChanged(nodeStateWatches.keySet(), liveNodes);
|
}
|
||||||
} catch (KeeperException e) {
|
} catch (KeeperException e) {
|
||||||
if (e.code() == KeeperException.Code.SESSIONEXPIRED
|
if (e.code() == KeeperException.Code.SESSIONEXPIRED
|
||||||
|| e.code() == KeeperException.Code.CONNECTIONLOSS) {
|
|| e.code() == KeeperException.Code.CONNECTIONLOSS) {
|
||||||
@ -528,7 +528,9 @@ public class Overseer implements NodeStateChangeListener, ShardLeaderListener {
|
|||||||
|
|
||||||
Set<String> downNodes = complement(oldLiveNodes, liveNodes);
|
Set<String> downNodes = complement(oldLiveNodes, liveNodes);
|
||||||
for(String node: downNodes) {
|
for(String node: downNodes) {
|
||||||
NodeStateWatcher watcher = nodeStateWatches.remove(node);
|
synchronized (nodeStateWatches) {
|
||||||
|
NodeStateWatcher watcher = nodeStateWatches.remove(node);
|
||||||
|
}
|
||||||
log.debug("Removed NodeStateWatcher for node:" + node);
|
log.debug("Removed NodeStateWatcher for node:" + node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user