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

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

Introduction

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

Prototype

public void setCorePoolSize(int corePoolSize) 

Source Link

Document

Set the ThreadPoolExecutor's core pool size.

Usage

From source file:com.codependent.niorest.SpringNioRestApplication.java

@Bean
public ThreadPoolTaskExecutor executor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(5000);
    return executor;
}

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

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

From source file:kymr.github.io.future.FutureSpringApplication.java

@Bean
ThreadPoolTaskExecutor tp() {/*from  w w w. j a  va2 s  .c  o  m*/
    ThreadPoolTaskExecutor te = new ThreadPoolTaskExecutor();
    te.setCorePoolSize(10); // default core thread pool
    te.setQueueCapacity(200);
    te.setMaxPoolSize(100); // after core pool is full -> after queue capacity (generally, unlimited) is full -> then, max pool size works.
    te.setThreadNamePrefix("mythread");
    te.initialize();
    //te.setAllowCoreThreadTimeOut();
    //te.getKeepAliveSeconds()
    //te.setTaskDecorator();      // for task monitoring

    return te;
}

From source file:com.sample.config.AsyncConfig.java

@Override
public Executor getAsyncExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(2); // seems like too many thread here will make gmail return error
    executor.setMaxPoolSize(2);//from   www.  ja v a  2s.com
    executor.setQueueCapacity(3000);
    executor.setThreadNamePrefix("EmailExecutor-");
    executor.initialize();
    return executor;
}

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

@Bean
public ThreadPoolTaskExecutor taskExecutor() {
    ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
    taskExecutor.setCorePoolSize(10);
    taskExecutor.setMaxPoolSize(1000);//from  w  w  w .j av  a 2s .  c  om
    taskExecutor.setQueueCapacity(10000);
    taskExecutor.setWaitForTasksToCompleteOnShutdown(true);
    return taskExecutor;
}

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:com.github.javarch.support.config.TaskConfig.java

/**.
 *//*from   ww  w  .  j a v a2 s .  co  m*/
@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:org.elasticsoftware.elasticactors.configuration.AppConfiguration.java

@Bean(name = "asyncExecutor")
public Executor getAsyncExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(Runtime.getRuntime().availableProcessors());
    executor.setMaxPoolSize(Runtime.getRuntime().availableProcessors() * 3);
    executor.setQueueCapacity(1024);/*w ww .  j  a v  a2  s  .  c o m*/
    executor.setThreadNamePrefix("ASYNCHRONOUS-ANNOTATION-EXECUTOR-");
    executor.initialize();
    return executor;
}

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

@Override
public Executor getAsyncExecutor() {
    logger.debug("Enter: getAsynchExecutor");
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(7);
    executor.setMaxPoolSize(42);//from ww w  .  j av a2  s .c o m
    executor.setQueueCapacity(11);
    executor.setThreadNamePrefix("AsyncExecutor-");
    executor.initialize();
    logger.debug("Exit: getAsynchExecutor");
    return executor;
}

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

/**
 * Executor dedicated to searches against lucene index
 * //from   w  w  w . j a v a 2 s.  c o  m
 * @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;
}