use of org.apache.commons.lang3.concurrent.BasicThreadFactory in project Activiti by Activiti.
the class DefaultAsyncJobExecutor method initAsyncJobExecutionThreadPool.
protected void initAsyncJobExecutionThreadPool() {
if (threadPoolQueue == null) {
log.info("Creating thread pool queue of size {}", queueSize);
threadPoolQueue = new ArrayBlockingQueue<Runnable>(queueSize);
}
if (executorService == null) {
log.info("Creating executor service with corePoolSize {}, maxPoolSize {} and keepAliveTime {}", corePoolSize, maxPoolSize, keepAliveTime);
BasicThreadFactory threadFactory = new BasicThreadFactory.Builder().namingPattern("activiti-async-job-executor-thread-%d").build();
executorService = new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, TimeUnit.MILLISECONDS, threadPoolQueue, threadFactory);
}
}
use of org.apache.commons.lang3.concurrent.BasicThreadFactory in project xwiki-platform by xwiki.
the class DefaultWikiProvisioningJobExecutor method initialize.
@Override
public void initialize() throws InitializationException {
this.jobs = new HashMap<List<String>, WikiProvisioningJob>();
// Setup jobs thread
BasicThreadFactory factory = new BasicThreadFactory.Builder().namingPattern("XWiki provisioning thread").daemon(true).priority(Thread.MIN_PRIORITY).build();
this.jobExecutor = Executors.newCachedThreadPool(factory);
}
use of org.apache.commons.lang3.concurrent.BasicThreadFactory in project tutorials by eugenp.
the class Lang3UtilsTest method testBuildDefaults.
@Test
public void testBuildDefaults() {
BasicThreadFactory.Builder builder = new BasicThreadFactory.Builder();
BasicThreadFactory factory = builder.build();
assertNull("No naming pattern set Yet", factory.getNamingPattern());
BasicThreadFactory factory2 = builder.namingPattern("sampleNamingPattern").daemon(true).priority(Thread.MIN_PRIORITY).build();
assertNotNull("Got a naming pattern", factory2.getNamingPattern());
assertEquals("sampleNamingPattern", factory2.getNamingPattern());
}
Aggregations