lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1292093 - /lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java
Date Wed, 22 Feb 2012 00:41:15 GMT
Author: markrmiller
Date: Wed Feb 22 00:41:15 2012
New Revision: 1292093

URL: http://svn.apache.org/viewvc?rev=1292093&view=rev
Log:
protect access with sync

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java?rev=1292093&r1=1292092&r2=1292093&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java Wed Feb 22 00:41:15
2012
@@ -494,9 +494,9 @@ public class Overseer implements NodeSta
                 try {
                     List<String> liveNodes = zkClient.getChildren(
                         ZkStateReader.LIVE_NODES_ZKNODE, this, true);
-                    Set<String> liveNodesSet = new HashSet<String>();
-                    liveNodesSet.addAll(liveNodes);
-                    processLiveNodesChanged(nodeStateWatches.keySet(), liveNodes);
+                    synchronized (nodeStateWatches) {
+                      processLiveNodesChanged(nodeStateWatches.keySet(), liveNodes);
+                    }
                 } catch (KeeperException e) {
                   if (e.code() == KeeperException.Code.SESSIONEXPIRED
                       || e.code() == KeeperException.Code.CONNECTIONLOSS) {
@@ -528,7 +528,9 @@ public class Overseer implements NodeSta
     
     Set<String> downNodes = complement(oldLiveNodes, liveNodes);
     for(String node: downNodes) {
-      NodeStateWatcher watcher = nodeStateWatches.remove(node);
+      synchronized (nodeStateWatches) {
+        NodeStateWatcher watcher = nodeStateWatches.remove(node);
+      }
       log.debug("Removed NodeStateWatcher for node:" + node);
     }
   }



Mime
View raw message