accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [1/3] git commit: ACCUMULO-3305 Use stopProcessWithTimeout instead of directly using Process API
Date Thu, 06 Nov 2014 17:32:32 GMT
Repository: accumulo
Updated Branches:
  refs/heads/1.6 b7b55eb64 -> cb262120e
  refs/heads/master 2f9340932 -> ce37a675f


ACCUMULO-3305 Use stopProcessWithTimeout instead of directly using Process API

We don't know if the start of a Process might be delayed, and, if we
call destroy before this happens, then waitFor appears to hang
indefinitely. Use the existing thread pool to guard against
an inf loop.


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

Branch: refs/heads/1.6
Commit: cb262120e8c11ea0afd5c08eb1124d9975941c8f
Parents: b7b55eb
Author: Josh Elser <elserj@apache.org>
Authored: Thu Nov 6 12:17:18 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Thu Nov 6 12:17:18 2014 -0500

----------------------------------------------------------------------
 .../impl/MiniAccumuloClusterImpl.java           | 38 +++++++++++++++-----
 1 file changed, 29 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/cb262120/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
index 8216441..d45ef0f 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
@@ -631,8 +631,13 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster {
     switch (type) {
       case MASTER:
         if (proc.equals(masterProcess)) {
-          masterProcess.destroy();
-          masterProcess.waitFor();
+          try {
+            stopProcessWithTimeout(masterProcess, 30, TimeUnit.SECONDS);
+          } catch (ExecutionException e) {
+            log.warn("Master did not fully stop after 30 seconds", e);
+          } catch (TimeoutException e) {
+            log.warn("Master did not fully stop after 30 seconds", e);
+          }
           masterProcess = null;
           found = true;
         }
@@ -642,8 +647,13 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster {
           for (Process tserver : tabletServerProcesses) {
             if (proc.equals(tserver)) {
               tabletServerProcesses.remove(tserver);
-              tserver.destroy();
-              tserver.waitFor();
+              try {
+                stopProcessWithTimeout(tserver, 30, TimeUnit.SECONDS);
+              } catch (ExecutionException e) {
+                log.warn("TabletServer did not fully stop after 30 seconds", e);
+              } catch (TimeoutException e) {
+                log.warn("TabletServer did not fully stop after 30 seconds", e);
+              }
               found = true;
               break;
             }
@@ -652,16 +662,26 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster {
         break;
       case ZOOKEEPER:
         if (proc.equals(zooKeeperProcess)) {
-          zooKeeperProcess.destroy();
-          zooKeeperProcess.waitFor();
+          try {
+            stopProcessWithTimeout(zooKeeperProcess, 30, TimeUnit.SECONDS);
+          } catch (ExecutionException e) {
+            log.warn("ZooKeeper did not fully stop after 30 seconds", e);
+          } catch (TimeoutException e) {
+            log.warn("ZooKeeper did not fully stop after 30 seconds", e);
+          }
           zooKeeperProcess = null;
           found = true;
         }
         break;
       case GARBAGE_COLLECTOR:
         if (proc.equals(gcProcess)) {
-          gcProcess.destroy();
-          gcProcess.waitFor();
+          try {
+            stopProcessWithTimeout(gcProcess, 30, TimeUnit.SECONDS);
+          } catch (ExecutionException e) {
+            log.warn("GarbageCollector did not fully stop after 30 seconds", e);
+          } catch (TimeoutException e) {
+            log.warn("GarbageCollector did not fully stop after 30 seconds", e);
+          }
           gcProcess = null;
           found = true;
         }
@@ -829,7 +849,7 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster {
   /**
    * Get programmatic interface to information available in a normal monitor. XXX the returned
structure won't contain information about the metadata table
    * until there is data in it. e.g. if you want to see the metadata table you should create
a table.
-   * 
+   *
    * @since 1.6.1
    */
   public MasterMonitorInfo getMasterMonitorInfo() throws AccumuloException, AccumuloSecurityException
{


Mime
View raw message