accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [12/50] [abbrv] accumulo git commit: ACCUMULO-3167 Consolidate more ClusterControl methods.
Date Wed, 26 Nov 2014 04:23:28 GMT
ACCUMULO-3167 Consolidate more ClusterControl methods.


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

Branch: refs/heads/1.6
Commit: 9bf41fd145b666d8025fc37526503884855527da
Parents: 7583946
Author: Josh Elser <elserj@apache.org>
Authored: Fri Nov 21 15:35:40 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Mon Nov 24 18:08:51 2014 -0500

----------------------------------------------------------------------
 .../standalone/StandaloneClusterControl.java    | 32 ++++++++------------
 1 file changed, 13 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/9bf41fd1/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
index c9f395d..9f93161 100644
--- a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
@@ -151,7 +151,10 @@ public class StandaloneClusterControl implements ClusterControl {
   @Override
   public void start(ServerType server, String hostname) throws IOException {
     String[] cmd = new String[] {startServerPath, hostname, getProcessString(server)};
-    exec(hostname, cmd);
+    Entry<Integer,String> pair = exec(hostname, cmd);
+    if (0 != pair.getKey()) {
+      throw new IOException("Start " + server + " on " + hostname + " failed for execute
successfully");
+    }
   }
 
   @Override
@@ -192,12 +195,9 @@ public class StandaloneClusterControl implements ClusterControl {
 
   @Override
   public void stop(ServerType server, String hostname) throws IOException {
-    String pid = getPid(server, accumuloHome, hostname);
-
     // TODO Use `accumulo admin stop` for tservers, instrument clean stop for GC, monitor,
tracer instead kill
 
-    String[] stopCmd = new String[] {"kill", "-9", pid};
-    exec(hostname, stopCmd);
+    kill(server, hostname);
   }
 
   @Override
@@ -212,36 +212,30 @@ public class StandaloneClusterControl implements ClusterControl {
 
     String[] stopCmd;
     if (isSignalNumber) {
-      stopCmd = new String[] {"kill", signal, pid};
+      stopCmd = new String[] {"kill", "-" + signal, pid};
     } else {
       stopCmd = new String[] {"kill", "-s", signal, pid};
     }
 
-    exec(hostname, stopCmd);
+    Entry<Integer,String> pair = exec(hostname, stopCmd);
+    if (0 != pair.getKey()) {
+      throw new IOException("Signal " + signal + " to " + server + " on " + hostname + "
failed for execute successfully");
+    }
   }
 
   @Override
   public void suspend(ServerType server, String hostname) throws IOException {
-    String pid = getPid(server, accumuloHome, hostname);
-
-    String[] stopCmd = new String[] {"kill", "-s", "SIGSTOP", pid};
-    exec(hostname, stopCmd);
+    signal(server, hostname, "SIGSTOP");
   }
 
   @Override
   public void resume(ServerType server, String hostname) throws IOException {
-    String pid = getPid(server, accumuloHome, hostname);
-
-    String[] stopCmd = new String[] {"kill", "-s", "SIGCONT", pid};
-    exec(hostname, stopCmd);
+    signal(server, hostname, "SIGCONT");
   }
 
   @Override
   public void kill(ServerType server, String hostname) throws IOException {
-    String pid = getPid(server, accumuloHome, hostname);
-
-    String[] stopCmd = new String[] {"kill", "-s", "SIGKILL", pid};
-    exec(hostname, stopCmd);
+    signal(server, hostname, "SIGKILL");
   }
 
   protected String getPid(ServerType server, String accumuloHome, String hostname) throws
IOException {


Mime
View raw message