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:uk.gov.nationalarchives.discovery.taxonomy.common.config.AsyncConfiguration.java

/**
 * executor dedicated to searches against in memory index
 * /* ww  w  .j  a v a 2s  .  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;
}

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);//from   www.j a va 2  s  .co m
    executor.setMaxPoolSize(42);
    executor.setQueueCapacity(11);
    executor.setThreadNamePrefix("SpringExecutor-");
    executor.initialize();
    return executor;
}

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   w  w  w  .  j a  v a  2s .c  o  m*/
    executor.setQueueCapacity(3000);
    executor.setThreadNamePrefix("EmailExecutor-");
    executor.initialize();
    return executor;
}

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

@Override
@Bean//ww  w .  j av  a2 s.  c o m
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:com.axel.config.ServiceConfig.java

@Override
public Executor getAsyncExecutor() {
    log.debug("Creating Async Task Executor");
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    // to customize with your requirements
    executor.setCorePoolSize(5);//  www  .  ja v a  2 s .c o  m
    executor.setMaxPoolSize(40);
    executor.setQueueCapacity(100);
    executor.setThreadNamePrefix("MyExecutor-");
    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);
    executor.setThreadNamePrefix("ASYNCHRONOUS-ANNOTATION-EXECUTOR-");
    executor.initialize();/*from   w w  w .  jav a2s  . co  m*/
    return executor;
}

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;
}

From source file:cz.muni.fi.editor.test.service.support.configs.TestConfiguration.java

@Override
public Executor getAsyncExecutor() {
    // move to configuration
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(4);//from  ww w. ja v  a2  s .c o  m
    executor.setMaxPoolSize(42);
    executor.setQueueCapacity(11);
    executor.setThreadNamePrefix("EditorExecutor-");
    executor.initialize();

    return executor;
}

From source file:org.homiefund.config.ApplicationConfiguration.java

@Override
public Executor getAsyncExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(4);//from   w ww .j av a 2 s.c om
    executor.setMaxPoolSize(42);
    executor.setQueueCapacity(12);
    executor.setThreadNamePrefix("HomieExecutor-");

    executor.initialize();

    return executor;
}

From source file:org.elasticsoftware.elasticactors.examples.springweb.config.ApplicationContextConfiguration.java

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