use of org.apache.hadoop.hbase.procedure2.ProcedureExecutor in project hbase by apache.
the class ProcedureTestingUtility method restart.
public static <TEnv> void restart(final ProcedureExecutor<TEnv> procExecutor, final boolean avoidTestKillDuringRestart, final boolean failOnCorrupted, final Callable<Void> stopAction, final Callable<Void> startAction) throws Exception {
final ProcedureStore procStore = procExecutor.getStore();
final int storeThreads = procExecutor.getCorePoolSize();
final int execThreads = procExecutor.getCorePoolSize();
final ProcedureExecutor.Testing testing = procExecutor.testing;
if (avoidTestKillDuringRestart) {
procExecutor.testing = null;
}
// stop
LOG.info("RESTART - Stop");
procExecutor.stop();
procStore.stop(false);
if (stopAction != null) {
stopAction.call();
}
procExecutor.join();
procExecutor.getScheduler().clear();
// nothing running...
// re-start
LOG.info("RESTART - Start");
procStore.start(storeThreads);
procExecutor.start(execThreads, failOnCorrupted);
if (startAction != null) {
startAction.call();
}
if (avoidTestKillDuringRestart) {
procExecutor.testing = testing;
}
}
use of org.apache.hadoop.hbase.procedure2.ProcedureExecutor in project hbase by apache.
the class ProcedureTestingUtility method submitAndWait.
public static <TEnv> long submitAndWait(Configuration conf, TEnv env, Procedure<TEnv> proc) throws IOException {
NoopProcedureStore procStore = new NoopProcedureStore();
ProcedureExecutor<TEnv> procExecutor = new ProcedureExecutor<>(conf, env, procStore);
procStore.start(1);
procExecutor.start(1, false);
try {
return submitAndWait(procExecutor, proc, HConstants.NO_NONCE, HConstants.NO_NONCE);
} finally {
procStore.stop(false);
procExecutor.stop();
}
}
Aggregations