Search in sources :

Example 1 with NamedThreadFactory

use of com.palantir.common.concurrent.NamedThreadFactory in project atlasdb by palantir.

the class DbKvs method newFixedThreadPool.

private static ThreadPoolExecutor newFixedThreadPool(int maxPoolSize) {
    ThreadPoolExecutor pool = PTExecutors.newThreadPoolExecutor(maxPoolSize, maxPoolSize, 15L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("Atlas DbKvs reader", true));
    pool.allowCoreThreadTimeOut(false);
    return pool;
}
Also used : NamedThreadFactory(com.palantir.common.concurrent.NamedThreadFactory) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor)

Example 2 with NamedThreadFactory

use of com.palantir.common.concurrent.NamedThreadFactory in project atlasdb by palantir.

the class AbstractKeyValueService method createFixedThreadPool.

/**
 * Creates a fixed thread pool.
 *
 * @param threadNamePrefix thread name prefix
 * @param poolSize fixed thread pool size
 * @return a new fixed size thread pool with a keep alive time of 1 minute
 */
protected static ExecutorService createFixedThreadPool(String threadNamePrefix, int poolSize) {
    ThreadPoolExecutor executor = PTExecutors.newFixedThreadPool(poolSize, new NamedThreadFactory(threadNamePrefix, false));
    executor.setKeepAliveTime(1, TimeUnit.MINUTES);
    return executor;
}
Also used : NamedThreadFactory(com.palantir.common.concurrent.NamedThreadFactory) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor)

Example 3 with NamedThreadFactory

use of com.palantir.common.concurrent.NamedThreadFactory in project atlasdb by palantir.

the class CassandraSchemaLockCleaner method getCassandraTableDropper.

private static CassandraTableDropper getCassandraTableDropper(CassandraKeyValueServiceConfig config, CassandraClientPool clientPool, TracingQueryRunner tracingQueryRunner) {
    WrappingQueryRunner wrappingQueryRunner = new WrappingQueryRunner(tracingQueryRunner);
    ExecutorService executorService = PTExecutors.newFixedThreadPool(config.poolSize(), new NamedThreadFactory("Atlas CleanCassLocksState", false));
    TaskRunner taskRunner = new TaskRunner(executorService);
    CellLoader cellLoader = new CellLoader(config, clientPool, wrappingQueryRunner, taskRunner);
    CellValuePutter cellValuePutter = new CellValuePutter(config, clientPool, taskRunner, wrappingQueryRunner, ConsistencyLevel.QUORUM);
    return new CassandraTableDropper(config, clientPool, cellLoader, cellValuePutter, wrappingQueryRunner, ConsistencyLevel.ALL);
}
Also used : NamedThreadFactory(com.palantir.common.concurrent.NamedThreadFactory) ExecutorService(java.util.concurrent.ExecutorService)

Aggregations

NamedThreadFactory (com.palantir.common.concurrent.NamedThreadFactory)3 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)2 ExecutorService (java.util.concurrent.ExecutorService)1