use of org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder in project hbase by apache.
the class TestRegionNormalizerWorker method before.
@Before
public void before() throws Exception {
MockitoAnnotations.initMocks(this);
when(masterServices.skipRegionManagementAction(any())).thenReturn(false);
testingUtility = new HBaseCommonTestingUtil();
queue = new RegionNormalizerWorkQueue<>();
workerThreadThrowable.set(null);
final String threadNameFmt = TestRegionNormalizerWorker.class.getSimpleName() + "-" + testName.getMethodName() + "-%d";
final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat(threadNameFmt).setDaemon(true).setUncaughtExceptionHandler((t, e) -> workerThreadThrowable.set(e)).build();
workerPool = Executors.newSingleThreadExecutor(threadFactory);
}
use of org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder in project hbase by apache.
the class TestAssignmentManagerBase method setUp.
@Before
public void setUp() throws Exception {
util = new HBaseTestingUtil();
this.executor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setUncaughtExceptionHandler((t, e) -> LOG.warn("Uncaught: ", e)).build());
setupConfiguration(util.getConfiguration());
master = new MockMasterServices(util.getConfiguration(), this.regionsToRegionServers);
rsDispatcher = new MockRSProcedureDispatcher(master);
master.start(NSERVERS, rsDispatcher);
newRsAdded = 0;
am = master.getAssignmentManager();
assignProcMetrics = am.getAssignmentManagerMetrics().getAssignProcMetrics();
unassignProcMetrics = am.getAssignmentManagerMetrics().getUnassignProcMetrics();
moveProcMetrics = am.getAssignmentManagerMetrics().getMoveProcMetrics();
reopenProcMetrics = am.getAssignmentManagerMetrics().getReopenProcMetrics();
openProcMetrics = am.getAssignmentManagerMetrics().getOpenProcMetrics();
closeProcMetrics = am.getAssignmentManagerMetrics().getCloseProcMetrics();
setUpMeta();
}
use of org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder in project hbase by apache.
the class TestAsyncFSWAL method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
GROUP = new NioEventLoopGroup(1, new ThreadFactoryBuilder().setNameFormat("TestAsyncFSWAL-pool-%d").setDaemon(true).setUncaughtExceptionHandler(Threads.LOGGING_EXCEPTION_HANDLER).build());
CHANNEL_CLASS = NioSocketChannel.class;
AbstractTestFSWAL.setUpBeforeClass();
}
use of org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder in project hbase by apache.
the class TestAsyncWALReplay method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
GROUP = new NioEventLoopGroup(1, new ThreadFactoryBuilder().setNameFormat("TestAsyncWALReplay-pool-%d").setDaemon(true).setUncaughtExceptionHandler(Threads.LOGGING_EXCEPTION_HANDLER).build());
CHANNEL_CLASS = NioSocketChannel.class;
Configuration conf = AbstractTestWALReplay.TEST_UTIL.getConfiguration();
conf.set(WALFactory.WAL_PROVIDER, "asyncfs");
AbstractTestWALReplay.setUpBeforeClass();
}
use of org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder in project hbase by apache.
the class ThriftServer method createExecutor.
protected ExecutorService createExecutor(BlockingQueue<Runnable> callQueue, int minWorkers, int maxWorkers) {
ThreadFactoryBuilder tfb = new ThreadFactoryBuilder();
tfb.setDaemon(true);
tfb.setNameFormat("thrift-worker-%d");
ThreadPoolExecutor threadPool = new THBaseThreadPoolExecutor(minWorkers, maxWorkers, Long.MAX_VALUE, TimeUnit.SECONDS, callQueue, tfb.build(), metrics);
threadPool.allowCoreThreadTimeOut(true);
return threadPool;
}
Aggregations