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 b3eff31432
commit 646770dd51
3 changed files with 8 additions and 12 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

@ -18,12 +18,15 @@
package org.apache.hadoop.hbase.master.balancer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.*;
import org.apache.hadoop.hbase.CategoryBasedTimeout;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.MiniHBaseCluster;
import org.apache.hadoop.hbase.TableName;
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 +199,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();