lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject lucene-solr:master: SOLR-9846: Try and make sure Overseer is always closed in tests and it's threads are done when it exists close.
Date Sun, 12 Feb 2017 19:58:13 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master 1700e860c -> b5c7bd1d1


SOLR-9846: Try and make sure Overseer is always closed in tests and it's threads are done
when it exists close.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/b5c7bd1d
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/b5c7bd1d
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/b5c7bd1d

Branch: refs/heads/master
Commit: b5c7bd1d10f3df8b2a622f3d76bee72f028cc483
Parents: 1700e86
Author: markrmiller <markrmiller@apache.org>
Authored: Sun Feb 12 14:58:06 2017 -0500
Committer: markrmiller <markrmiller@apache.org>
Committed: Sun Feb 12 14:58:06 2017 -0500

----------------------------------------------------------------------
 .../java/org/apache/solr/cloud/Overseer.java    | 21 +++++++++++++++++++-
 .../org/apache/solr/cloud/ZkController.java     |  5 ++++-
 2 files changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b5c7bd1d/solr/core/src/java/org/apache/solr/cloud/Overseer.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/Overseer.java b/solr/core/src/java/org/apache/solr/cloud/Overseer.java
index a618874..0b74ccb 100644
--- a/solr/core/src/java/org/apache/solr/cloud/Overseer.java
+++ b/solr/core/src/java/org/apache/solr/cloud/Overseer.java
@@ -44,6 +44,7 @@ import org.apache.solr.common.cloud.ZkNodeProps;
 import org.apache.solr.common.cloud.ZkStateReader;
 import org.apache.solr.common.params.CollectionParams;
 import org.apache.solr.common.util.IOUtils;
+import org.apache.solr.common.util.ObjectReleaseTracker;
 import org.apache.solr.common.util.Utils;
 import org.apache.solr.core.CloudConfig;
 import org.apache.solr.handler.admin.CollectionsHandler;
@@ -489,6 +490,7 @@ public class Overseer implements Closeable {
     this.zkController = zkController;
     this.stats = new Stats();
     this.config = config;
+    assert ObjectReleaseTracker.track(this);
   }
   
   public synchronized void start(String id) {
@@ -540,11 +542,12 @@ public class Overseer implements Closeable {
   }
   
   public synchronized void close() {
-    if (closed || id == null) return;
+    if (closed) return;
     log.info("Overseer (id=" + id + ") closing");
     
     doClose();
     this.closed = true;
+    assert ObjectReleaseTracker.release(this);
   }
 
   private void doClose() {
@@ -562,6 +565,22 @@ public class Overseer implements Closeable {
       arfoThread.interrupt();
     }
     
+    if (updaterThread != null) {
+      try {
+        updaterThread.join();
+      } catch (InterruptedException e) {}
+    }
+    if (ccThread != null) {
+      try {
+        ccThread.join();
+      } catch (InterruptedException e) {}
+    }
+    if (arfoThread != null) {
+      try {
+        arfoThread.join();
+      } catch (InterruptedException e) {}
+    }
+    
     updaterThread = null;
     ccThread = null;
     arfoThread = null;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b5c7bd1d/solr/core/src/java/org/apache/solr/cloud/ZkController.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index eba7067..89a88e3 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -75,6 +75,7 @@ import org.apache.solr.common.cloud.ZooKeeperException;
 import org.apache.solr.common.params.CollectionParams;
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.SolrParams;
+import org.apache.solr.common.util.ObjectReleaseTracker;
 import org.apache.solr.common.util.StrUtils;
 import org.apache.solr.common.util.URLUtil;
 import org.apache.solr.common.util.Utils;
@@ -417,6 +418,8 @@ public class ZkController {
     });
 
     init(registerOnReconnect);
+    
+    assert ObjectReleaseTracker.track(this);
   }
 
   public int getLeaderVoteWait() {
@@ -552,7 +555,7 @@ public class ZkController {
         }
       }
     }
-
+    assert ObjectReleaseTracker.release(this);
   }
 
   /**


Mime
View raw message