You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/07/28 01:32:07 UTC

[lucene-solr] 01/01: @412 Try a couple tweaks in ZkTestServer shutdown.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit d117b6aebf3c8a48d885b766df649f99d554a50c
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Mon Jul 27 20:24:14 2020 -0500

    @412 Try a couple tweaks in ZkTestServer shutdown.
---
 .../java/org/apache/solr/cloud/ZkTestServer.java    | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java b/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
index ad73f78..72a0e44 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
@@ -399,12 +399,12 @@ public class ZkTestServer implements Closeable {
     //    if (zkDb != null) zkDb.clear();
         try (ParWork worker = new ParWork(this, true)) {
           worker.add("ZkTestInternals", () -> {
-                    cnxnFactory.shutdown();
-                    cnxnFactory.join();
-                    return cnxnFactory;
-                  }, ()->{
-            zooKeeperServer.shutdown(true);
-            return  zooKeeperServer;
+            zooKeeperServer.shutdown(false);
+            return zooKeeperServer;
+          }, () -> {
+            cnxnFactory.shutdown();
+            cnxnFactory.join();
+            return cnxnFactory;
           });
         }
       } finally {
@@ -523,7 +523,7 @@ public class ZkTestServer implements Closeable {
     zkServer.zooKeeperServer.setZKDatabase(zkDb);
   }
 
-  public void run() throws InterruptedException, IOException {
+  public synchronized void run() throws InterruptedException, IOException {
     run(false);
   }
 
@@ -608,6 +608,7 @@ public class ZkTestServer implements Closeable {
       throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
     } catch (InterruptedException e) {
       ParWork.propegateInterrupt(e);
+      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
     }
   }
 
@@ -622,7 +623,11 @@ public class ZkTestServer implements Closeable {
       ParWork.propegateInterrupt("Exception trying to print zk layout to log on shutdown", e);
     }
     if (zkMonitoringFile != null && chRootClient != null && zkServer != null) {
-      writeZkMonitorFile();
+      try {
+        writeZkMonitorFile();
+      } catch (Exception e2) {
+        ParWork.propegateInterrupt("Exception trying to write zk layout to file on shutdown", e2);
+      }
     }
 
    // zooThread.interrupt();