HBASE-19527 Make ExecutorService threads daemon=true

Set the ProcedureExcecutor worker threads as daemon.
Ditto for the timeout thread.

Remove hack from TestRegionsOnMasterOptions that was
put in place because the test would not go down.
This commit is contained in:
Michael Stack 2017-12-15 13:57:16 -08:00
parent 4676d4bf4a
commit 5e4ed33fa2
3 changed files with 3 additions and 11 deletions

View File

@ -1710,6 +1710,7 @@ public class ProcedureExecutor<TEnvironment> {
public WorkerThread(final ThreadGroup group) {
super(group, "ProcExecWrkr-" + workerId.incrementAndGet());
setDaemon(true);
}
@Override
@ -1784,6 +1785,7 @@ public class ProcedureExecutor<TEnvironment> {
public TimeoutExecutorThread(final ThreadGroup group) {
super(group, "ProcExecTimeout");
setDaemon(true);
}
@Override

View File

@ -178,7 +178,7 @@ public class ExecutorService {
// name the threads for this threadpool
ThreadFactoryBuilder tfb = new ThreadFactoryBuilder();
tfb.setNameFormat(this.name + "-%d");
// TODO: Should these executors be daemon threads?
tfb.setDaemon(true);
this.threadPoolExecutor.setThreadFactory(tfb.build());
}

View File

@ -23,7 +23,6 @@ import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.master.LoadBalancer;
import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.regionserver.Region;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.JVMClusterUtil;
import org.apache.hadoop.hbase.util.Threads;
@ -196,15 +195,6 @@ public class TestRegionsOnMasterOptions {
// still only carry system regions post crash.
assertEquals(masterCount, mNewActualCount);
}
// Disable balancer and wait till RIT done else cluster won't go down.
TEST_UTIL.getAdmin().balancerSwitch(false, true);
while (true) {
if (!TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().
isMetaRegionInTransition()) {
break;
}
Threads.sleep(10);
}
} finally {
LOG.info("Running shutdown of cluster");
TEST_UTIL.shutdownMiniCluster();