Example usage for org.springframework.scheduling.concurrent ThreadPoolTaskExecutor setMaxPoolSize

List of usage examples for org.springframework.scheduling.concurrent ThreadPoolTaskExecutor setMaxPoolSize

Introduction

In this page you can find the example usage for org.springframework.scheduling.concurrent ThreadPoolTaskExecutor setMaxPoolSize.

Prototype

public void setMaxPoolSize(int maxPoolSize) 

Source Link

Document

Set the ThreadPoolExecutor's maximum pool size.

Usage

From source file:net.brainage.nest.NestApplication.java

@Bean
public AsyncTaskExecutor asyncTaskExecutor() {
    ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
    taskExecutor.setCorePoolSize(5);//from  w w w. j  a v a 2  s .  c  o m
    taskExecutor.setMaxPoolSize(200);
    taskExecutor.setQueueCapacity(100);
    taskExecutor.setThreadNamePrefix("async-task-executor-");
    taskExecutor.initialize();
    return taskExecutor;
}

From source file:com.github.javarch.support.config.TaskConfig.java

/**.
 *//*from ww  w .  j a va  2s .c  om*/
@Bean
public Executor taskExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(7);
    executor.setMaxPoolSize(42);
    executor.setQueueCapacity(11);
    executor.setThreadNamePrefix("Executor-");
    executor.initialize();
    return executor;
}

From source file:com.bitran.config.Config.java

@Bean
public ThreadPoolTaskExecutor taskExecutor() {
    ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
    taskExecutor.setCorePoolSize(10);/*www.  j  a  v  a  2 s  .  c  o  m*/
    taskExecutor.setMaxPoolSize(1000);
    taskExecutor.setQueueCapacity(10000);
    taskExecutor.setWaitForTasksToCompleteOnShutdown(true);
    return taskExecutor;
}

From source file:ch.javaee.basicMvc.config.SchedulingConfig.java

@Override
public Executor getAsyncExecutor() {
    logger.debug("Enter: getAsynchExecutor");
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(7);/*  w w w. j a  va 2s. co  m*/
    executor.setMaxPoolSize(42);
    executor.setQueueCapacity(11);
    executor.setThreadNamePrefix("AsyncExecutor-");
    executor.initialize();
    logger.debug("Exit: getAsynchExecutor");
    return executor;
}

From source file:com.apress.prospringintegration.channels.executorchannel.ExecutorChannelConfiguration.java

@Bean
public Executor executor() {
    ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
    threadPoolTaskExecutor.setCorePoolSize(5);
    threadPoolTaskExecutor.setMaxPoolSize(10);
    threadPoolTaskExecutor.setQueueCapacity(25);
    return threadPoolTaskExecutor;
}

From source file:cn.org.once.cstack.config.AsyncConfiguration.java

@Override
@Bean/*from www  . j a v a2 s  .com*/
public Executor getAsyncExecutor() {
    log.debug("Creating Async Task Executor");
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(5);
    executor.setMaxPoolSize(50);

    executor.setWaitForTasksToCompleteOnShutdown(true);

    executor.setQueueCapacity(10000);
    executor.setThreadNamePrefix("cloudunit-Executor-");
    executor.initialize();
    return executor;
}

From source file:burstcoin.jminer.core.CoreConfig.java

/**
 * Network pool./*from w  ww. j av  a2  s.  co m*/
 *
 * @return the thread pool task executor
 */
@Bean(name = "networkPool")
public ThreadPoolTaskExecutor networkPool() {
    ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
    pool.setMaxPoolSize(2);
    pool.setThreadPriority(Thread.NORM_PRIORITY + 1);
    return pool;
}

From source file:uk.gov.nationalarchives.discovery.taxonomy.common.config.AsyncConfiguration.java

/**
 * Executor dedicated to searches against lucene index
 * /*from  w ww  .  j a  v  a  2  s.c  om*/
 * @return
 */
public @Bean ThreadPoolTaskExecutor fsSearchTaskExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(fsThreadPoolSize);
    executor.setMaxPoolSize(fsThreadPoolSize);
    executor.setQueueCapacity(fsQueueCapacity);
    executor.setThreadNamePrefix("fsSearchTaskExecutor-");
    executor.initialize();
    return executor;
}

From source file:com.teradata.benchto.driver.DriverApp.java

@Bean
public ThreadPoolTaskExecutor defaultTaskExecutor() {
    ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
    taskExecutor.setMaxPoolSize(5);
    taskExecutor.setWaitForTasksToCompleteOnShutdown(true);
    taskExecutor.setAwaitTerminationSeconds(300);

    return taskExecutor;
}

From source file:uk.gov.nationalarchives.discovery.taxonomy.common.config.AsyncConfiguration.java

/**
 * executor dedicated to searches against in memory index
 * /*from   w  w  w. ja  v a  2 s . co  m*/
 * @return
 */
public @Bean ThreadPoolTaskExecutor memorySearchTaskExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(memoryThreadPoolSize);
    executor.setMaxPoolSize(memoryThreadPoolSize);
    executor.setQueueCapacity(memoryQueueCapacity);
    executor.setThreadNamePrefix("memorySearchTaskExecutor-");
    executor.initialize();
    return executor;
}