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:de.metas.procurement.webui.Application.java

/** @return default task executor used by {@link Async} calls */
@Bean//from w  w w. ja  va 2 s  .  com
public TaskExecutor taskExecutor() {
    final ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(1);
    executor.setMaxPoolSize(10);
    executor.setQueueCapacity(100);
    return executor;
}

From source file:com.epam.ta.reportportal.core.configs.JobsConfiguration.java

@Bean(name = "saveLogsTaskExecutor")
public TaskExecutor saveLogsTaskExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(20);/*from   ww  w .j  a v  a 2s . com*/
    executor.setMaxPoolSize(200);
    executor.setQueueCapacity(400);
    executor.setAllowCoreThreadTimeOut(true);
    executor.setThreadNamePrefix("logs-task-exec");
    executor.setRejectedExecutionHandler(new java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy());
    return executor;
}

From source file:org.tocode.poc.service.config.ServiceConfig.java

@Override
public Executor getAsyncExecutor() {

    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(20);/*www  . ja v  a2s  . c om*/
    executor.setMaxPoolSize(50);
    executor.setQueueCapacity(500);
    executor.setThreadNamePrefix("Service-Thread");
    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);//from   w w w  .  ja v a 2 s .c o m
    executor.setThreadNamePrefix("ASYNCHRONOUS-ANNOTATION-EXECUTOR-");
    executor.initialize();
    return executor;
}

From source file:org.obiba.mica.config.AsyncConfiguration.java

@Override
@Bean/*from  www  .j ava2  s . c o  m*/
public Executor getAsyncExecutor() {

    Integer poolSize = propertyResolver.getProperty("poolSize", Integer.class, DEFAULT_POOL_SIZE);

    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(poolSize);
    executor.setMaxPoolSize(poolSize);
    executor.setQueueCapacity(
            propertyResolver.getProperty("queueCapacity", Integer.class, DEFAULT_QUEUE_CAPACITY));
    executor.setThreadNamePrefix("mica-executor-");
    return new ExceptionHandlingAsyncTaskExecutor(executor);
}

From source file:org.obiba.mica.config.AsyncConfiguration.java

@Bean(name = "opalExecutor")
public Executor getOpalAsyncExecutor() {
    log.debug("Creating Async Task Executor");

    Integer poolSize = propertyResolver.getProperty("opal.poolSize", Integer.class, DEFAULT_POOL_SIZE);

    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(poolSize);/*from   ww  w.java2s  .com*/
    executor.setMaxPoolSize(poolSize);
    executor.setQueueCapacity(
            propertyResolver.getProperty("opal.queueCapacity", Integer.class, DEFAULT_QUEUE_CAPACITY));
    executor.setThreadNamePrefix("mica-opal-executor-");
    return new ExceptionHandlingAsyncTaskExecutor(executor);
}

From source file:eu.tripledframework.eventbus.autoconfigure.EventBusAutoConfiguration.java

private Executor taskExecutor() {
    ThreadPoolTaskExecutor executorService = new ThreadPoolTaskExecutor();
    executorService.setCorePoolSize(5);//from  ww  w . j  a  va 2s .c o  m
    executorService.setMaxPoolSize(10);

    executorService.afterPropertiesSet();
    return executorService;
}

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);//from w  w  w  .j  av  a  2s .co m
    pool.setMaxPoolSize(10);
    pool.setWaitForTasksToCompleteOnShutdown(true);
    return pool;
}

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

@Bean
ThreadPoolTaskExecutor tp() {//from   ww  w.ja  v  a  2 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:org.schedoscope.metascope.config.TaskConfiguration.java

@Bean(name = "background")
public TaskExecutor backgroundTaskExecutor() {
    ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
    threadPoolTaskExecutor.setCorePoolSize(5);
    threadPoolTaskExecutor.setMaxPoolSize(5);
    threadPoolTaskExecutor.setWaitForTasksToCompleteOnShutdown(true);
    return threadPoolTaskExecutor;
}