List of usage examples for org.springframework.scheduling.concurrent ThreadPoolTaskExecutor setCorePoolSize
public void setCorePoolSize(int corePoolSize)
From source file:org.tocode.poc.service.config.ServiceConfig.java
@Override public Executor getAsyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(20); executor.setMaxPoolSize(50);/* w w w. j av a 2 s . c o m*/ executor.setQueueCapacity(500); executor.setThreadNamePrefix("Service-Thread"); executor.initialize(); return executor; }
From source file:eu.tripledframework.eventbus.autoconfigure.EventBusAutoConfiguration.java
private Executor taskExecutor() { ThreadPoolTaskExecutor executorService = new ThreadPoolTaskExecutor(); executorService.setCorePoolSize(5); executorService.setMaxPoolSize(10);/* w ww . ja v a 2s . c o m*/ executorService.afterPropertiesSet(); return executorService; }
From source file:com.nayidisha.slowglow.config.SchedulerConfig.java
@Bean(name = "threadPoolTaskExecutor") public ThreadPoolTaskExecutor threadPoolTaskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setMaxPoolSize(5);//from w ww .j av a2 s. co m executor.setCorePoolSize(2); executor.setQueueCapacity(25); executor.setWaitForTasksToCompleteOnShutdown(true); return executor; }
From source file:com.apress.prospringintegration.concurrency.taskexecutorexample.TaskExecutorExampleConfiguration.java
@Bean public ThreadPoolTaskExecutor threadPoolTaskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(50); executor.setDaemon(false);/*from w ww .j a va 2s . com*/ executor.setWaitForTasksToCompleteOnShutdown(true); executor.setMaxPoolSize(100); executor.setAllowCoreThreadTimeOut(true); return executor; }
From source file:com.netflix.genie.web.configs.TaskConfig.java
/** * Get a task executor for executing tasks asynchronously that don't need to be scheduled at a recurring rate. * * @param poolSize The number of threads desired for this system. Likely best to do one more than number of CPUs * @return The task executor the system to use */// w w w . j a v a2s .c o m @Bean public AsyncTaskExecutor taskExecutor(@Value("${genie.tasks.executor.pool.size:1}") final int poolSize) { final ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(poolSize); return executor; }
From source file:org.bremersee.common.spring.autoconfigure.SchedulingAutoConfiguration.java
@Bean(name = { "taskExecutor", "metricsExecutor" }) @Primary//from w ww . j ava 2 s . c o m public Executor taskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(properties.getTaskExecutorCorePoolSize()); executor.setMaxPoolSize(properties.getTaskExecutorMaxPoolSize()); executor.setQueueCapacity(properties.getTaskExecutorQueueCapacity()); executor.setThreadNamePrefix(properties.getTaskExecutorThreadNamePrefix()); executor.initialize(); return executor; }
From source file:uk.ac.ebi.eva.vcfdump.server.VcfDumperWSConfig.java
@Bean public ThreadPoolTaskExecutor mvcAsyncThreadPool() { // this pool will be used by to handle async requests in the MVC controllers ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor(); // TODO: override those default values pool.setCorePoolSize(5); pool.setMaxPoolSize(10);/*from w w w . j a v a 2s . c om*/ pool.setWaitForTasksToCompleteOnShutdown(true); return pool; }
From source file:org.apache.nutch.storage.local.SpringConfiguration.java
@Override public Executor getAsyncExecutor() { // TODO move magic numbers to properties file ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(7); executor.setMaxPoolSize(42);/*from www . java 2s . c o m*/ executor.setQueueCapacity(11); executor.setThreadNamePrefix("SpringExecutor-"); executor.initialize(); return executor; }
From source file:org.apache.camel.component.xquery.XQueryConcurrencyTest.java
@Test public void testConcurrency() throws Exception { int total = 1000; MockEndpoint mock = getMockEndpoint("mock:result"); mock.expectedMessageCount(total);//from w w w. j a v a 2 s . co m // setup a task executor to be able send the messages in parallel ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(5); executor.afterPropertiesSet(); for (int i = 0; i < 5; i++) { final int threadCount = i; executor.execute(new Runnable() { public void run() { int start = threadCount * 200; for (int i = 0; i < 200; i++) { try { // do some random sleep to simulate spread in user activity Thread.sleep(new Random().nextInt(10)); } catch (InterruptedException e) { // ignore } template.sendBody(uri, "<person><id>" + (start + i + 1) + "</id><name>James</name></person>"); } } }); } mock.assertNoDuplicates(body()); assertMockEndpointsSatisfied(); executor.shutdown(); }
From source file:com.epam.ta.reportportal.core.configs.JobsConfiguration.java
@Bean(name = "autoAnalyzeTaskExecutor") public TaskExecutor autoAnalyzeTaskExecutor() { final ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor(); threadPoolTaskExecutor.setCorePoolSize(10); threadPoolTaskExecutor.setMaxPoolSize(30); threadPoolTaskExecutor.setQueueCapacity(200); threadPoolTaskExecutor.setAllowCoreThreadTimeOut(true); threadPoolTaskExecutor.setThreadNamePrefix("auto-analyze-exec"); return threadPoolTaskExecutor; }