Search in sources :

Example 1 with HadoopScheduledThreadPoolExecutor

use of org.apache.hadoop.util.concurrent.HadoopScheduledThreadPoolExecutor in project hadoop by apache.

the class NonAggregatingLogHandler method createScheduledThreadPoolExecutor.

ScheduledThreadPoolExecutor createScheduledThreadPoolExecutor(Configuration conf) {
    ThreadFactory tf = new ThreadFactoryBuilder().setNameFormat("LogDeleter #%d").build();
    sched = new HadoopScheduledThreadPoolExecutor(conf.getInt(YarnConfiguration.NM_LOG_DELETION_THREADS_COUNT, YarnConfiguration.DEFAULT_NM_LOG_DELETE_THREAD_COUNT), tf);
    return sched;
}
Also used : ThreadFactory(java.util.concurrent.ThreadFactory) HadoopScheduledThreadPoolExecutor(org.apache.hadoop.util.concurrent.HadoopScheduledThreadPoolExecutor) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder)

Example 2 with HadoopScheduledThreadPoolExecutor

use of org.apache.hadoop.util.concurrent.HadoopScheduledThreadPoolExecutor in project hadoop by apache.

the class JobHistory method serviceStart.

@Override
protected void serviceStart() throws Exception {
    hsManager.start();
    if (storage instanceof Service) {
        ((Service) storage).start();
    }
    scheduledExecutor = new HadoopScheduledThreadPoolExecutor(2, new ThreadFactoryBuilder().setNameFormat("Log Scanner/Cleaner #%d").build());
    scheduledExecutor.scheduleAtFixedRate(new MoveIntermediateToDoneRunnable(), moveThreadInterval, moveThreadInterval, TimeUnit.MILLISECONDS);
    // Start historyCleaner
    scheduleHistoryCleaner();
    super.serviceStart();
}
Also used : HadoopScheduledThreadPoolExecutor(org.apache.hadoop.util.concurrent.HadoopScheduledThreadPoolExecutor) AbstractService(org.apache.hadoop.service.AbstractService) Service(org.apache.hadoop.service.Service) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder)

Example 3 with HadoopScheduledThreadPoolExecutor

use of org.apache.hadoop.util.concurrent.HadoopScheduledThreadPoolExecutor in project hadoop by apache.

the class DeletionService method serviceInit.

@Override
protected void serviceInit(Configuration conf) throws Exception {
    ThreadFactory tf = new ThreadFactoryBuilder().setNameFormat("DeletionService #%d").build();
    if (conf != null) {
        sched = new HadoopScheduledThreadPoolExecutor(conf.getInt(YarnConfiguration.NM_DELETE_THREAD_COUNT, YarnConfiguration.DEFAULT_NM_DELETE_THREAD_COUNT), tf);
        debugDelay = conf.getInt(YarnConfiguration.DEBUG_NM_DELETE_DELAY_SEC, 0);
    } else {
        sched = new HadoopScheduledThreadPoolExecutor(YarnConfiguration.DEFAULT_NM_DELETE_THREAD_COUNT, tf);
    }
    sched.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
    sched.setKeepAliveTime(60L, SECONDS);
    if (stateStore.canRecover()) {
        recover(stateStore.loadDeletionServiceState());
    }
    super.serviceInit(conf);
}
Also used : ThreadFactory(java.util.concurrent.ThreadFactory) HadoopScheduledThreadPoolExecutor(org.apache.hadoop.util.concurrent.HadoopScheduledThreadPoolExecutor) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder)

Aggregations

ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)3 HadoopScheduledThreadPoolExecutor (org.apache.hadoop.util.concurrent.HadoopScheduledThreadPoolExecutor)3 ThreadFactory (java.util.concurrent.ThreadFactory)2 AbstractService (org.apache.hadoop.service.AbstractService)1 Service (org.apache.hadoop.service.Service)1