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

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

Introduction

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

Prototype

public void setQueueCapacity(int queueCapacity) 

Source Link

Document

Set the capacity for the ThreadPoolExecutor's BlockingQueue.

Usage

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

@Bean
public ThreadPoolTaskExecutor taskExecutor() {
    ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
    taskExecutor.setCorePoolSize(10);/*w w  w .ja va  2s  . c om*/
    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);/*www.  j  a v a2 s. c o  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:de.metas.procurement.webui.Application.java

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

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

/**
 * Executor dedicated to searches against lucene index
 * /*from  www.  j  a v a2s.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;
}

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  w ww .  j ava 2s .c o m
    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);/*from www  .  java  2  s. co  m*/
    executor.setMaxPoolSize(50);
    executor.setQueueCapacity(500);
    executor.setThreadNamePrefix("Service-Thread");
    executor.initialize();
    return executor;
}

From source file:de.codecentric.batch.configuration.TaskExecutorConfiguration.java

@Bean
public TaskExecutor taskExecutor() {
    ThreadPoolTaskExecutor taskExecutor = new MdcThreadPoolTaskExecutor();
    taskExecutor.setCorePoolSize(env.getProperty("batch.core.pool.size", Integer.class, 5));
    taskExecutor.setQueueCapacity(env.getProperty("batch.queue.capacity", Integer.class, Integer.MAX_VALUE));
    taskExecutor.setMaxPoolSize(env.getProperty("batch.max.pool.size", Integer.class, Integer.MAX_VALUE));
    taskExecutor.afterPropertiesSet();// w  w w.jav  a2  s . c o m
    return taskExecutor;
}

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

@Override
@Bean/* w w w.  jav a 2  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);//  w  w  w . j  a  va2s  .  c  o m
    executor.setMaxPoolSize(poolSize);
    executor.setQueueCapacity(
            propertyResolver.getProperty("opal.queueCapacity", Integer.class, DEFAULT_QUEUE_CAPACITY));
    executor.setThreadNamePrefix("mica-opal-executor-");
    return new ExceptionHandlingAsyncTaskExecutor(executor);
}