use of java.util.concurrent.ThreadFactory in project elasticsearch by elastic.
the class FixedExecutorBuilder method build.
@Override
ThreadPool.ExecutorHolder build(final FixedExecutorSettings settings, final ThreadContext threadContext) {
int size = settings.size;
int queueSize = settings.queueSize;
final ThreadFactory threadFactory = EsExecutors.daemonThreadFactory(EsExecutors.threadName(settings.nodeName, name()));
final ExecutorService executor = EsExecutors.newFixed(name(), size, queueSize, threadFactory, threadContext);
final ThreadPool.Info info = new ThreadPool.Info(name(), ThreadPool.ThreadPoolType.FIXED, size, size, null, queueSize < 0 ? null : new SizeValue(queueSize));
return new ThreadPool.ExecutorHolder(executor, info);
}
use of java.util.concurrent.ThreadFactory in project jetty.project by eclipse.
the class ScheduledExecutorScheduler method doStart.
@Override
protected void doStart() throws Exception {
scheduler = new ScheduledThreadPoolExecutor(1, new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread thread = ScheduledExecutorScheduler.this.thread = new Thread(threadGroup, r, name);
thread.setDaemon(daemon);
thread.setContextClassLoader(classloader);
return thread;
}
});
scheduler.setRemoveOnCancelPolicy(true);
super.doStart();
}
use of java.util.concurrent.ThreadFactory in project storm by apache.
the class Context method prepare.
/**
* initialization per Storm configuration
*/
@SuppressWarnings("rawtypes")
public void prepare(Map storm_conf) {
this.storm_conf = storm_conf;
connections = new HashMap<>();
//each context will have a single client channel factory
int maxWorkers = Utils.getInt(storm_conf.get(Config.STORM_MESSAGING_NETTY_CLIENT_WORKER_THREADS));
ThreadFactory bossFactory = new NettyRenameThreadFactory("client" + "-boss");
ThreadFactory workerFactory = new NettyRenameThreadFactory("client" + "-worker");
if (maxWorkers > 0) {
clientChannelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(bossFactory), Executors.newCachedThreadPool(workerFactory), maxWorkers);
} else {
clientChannelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(bossFactory), Executors.newCachedThreadPool(workerFactory));
}
clientScheduleService = new HashedWheelTimer(new NettyRenameThreadFactory("client-schedule-service"));
}
use of java.util.concurrent.ThreadFactory in project hadoop by apache.
the class CleanerService method serviceInit.
@Override
protected void serviceInit(Configuration conf) throws Exception {
this.conf = conf;
// create scheduler executor service that services the cleaner tasks
// use 2 threads to accommodate the on-demand tasks and reduce the chance of
// back-to-back runs
ThreadFactory tf = new ThreadFactoryBuilder().setNameFormat("Shared cache cleaner").build();
scheduledExecutor = HadoopExecutors.newScheduledThreadPool(2, tf);
super.serviceInit(conf);
}
use of java.util.concurrent.ThreadFactory in project hadoop by apache.
the class InMemorySCMStore method serviceInit.
/**
* The in-memory store bootstraps itself from the shared cache entries that
* exist in HDFS.
*/
@Override
protected void serviceInit(Configuration conf) throws Exception {
this.startTime = System.currentTimeMillis();
this.initialDelayMin = getInitialDelay(conf);
this.checkPeriodMin = getCheckPeriod(conf);
this.stalenessMinutes = getStalenessPeriod(conf);
bootstrap(conf);
ThreadFactory tf = new ThreadFactoryBuilder().setNameFormat("InMemorySCMStore").build();
scheduler = HadoopExecutors.newSingleThreadScheduledExecutor(tf);
super.serviceInit(conf);
}
Aggregations