You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/12/02 21:37:06 UTC
[18/50] [abbrv] accumulo git commit: ACCUMULO-3167 Consolidate more
ClusterControl methods.
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/metrics2
Commit: 9bf41fd145b666d8025fc37526503884855527da
Parents: 7583946
Author: Josh Elser <el...@apache.org>
Authored: Fri Nov 21 15:35:40 2014 -0500
Committer: Josh Elser <el...@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 {