HBASE-18629 Enhance ChaosMonkeyRunner with interruptibility - addendum makes stopRunner() static

This commit is contained in:
tedyu 2017-08-21 09:37:30 -07:00
parent 70d48b113e
commit fef7e8f7e8
1 changed files with 6 additions and 3 deletions

View File

@ -45,6 +45,8 @@ public class ChaosMonkeyRunner extends AbstractHBaseTool {
public static final String TABLE_NAME_OPT = "tableName"; public static final String TABLE_NAME_OPT = "tableName";
public static final String FAMILY_NAME_OPT = "familyName"; public static final String FAMILY_NAME_OPT = "familyName";
private static ChaosMonkeyRunner runner;
protected IntegrationTestingUtility util; protected IntegrationTestingUtility util;
protected ChaosMonkey monkey; protected ChaosMonkey monkey;
protected String monkeyToUse; protected String monkeyToUse;
@ -99,8 +101,8 @@ public class ChaosMonkeyRunner extends AbstractHBaseTool {
return 0; return 0;
} }
public void stopRunner() { public static void stopRunner() {
stop = true; runner.stop = true;
} }
public void setUpCluster() throws Exception { public void setUpCluster() throws Exception {
@ -176,7 +178,8 @@ public class ChaosMonkeyRunner extends AbstractHBaseTool {
System.arraycopy(args, 2, actualArgs, 0, argCount); System.arraycopy(args, 2, actualArgs, 0, argCount);
} }
IntegrationTestingUtility.setUseDistributedCluster(conf); IntegrationTestingUtility.setUseDistributedCluster(conf);
int ret = ToolRunner.run(conf, new ChaosMonkeyRunner(), actualArgs); runner = new ChaosMonkeyRunner();
int ret = ToolRunner.run(conf, runner, actualArgs);
System.exit(ret); System.exit(ret);
} }