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

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

Introduction

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

Prototype

ThreadPoolTaskExecutor

Source Link

Usage

From source file:Main.java

public static ThreadPoolTaskExecutor defaultPool(int corePoolSize) {
    ThreadPoolTaskExecutor ex = new ThreadPoolTaskExecutor();
    ex.setCorePoolSize(corePoolSize);/*  w w  w.  j a  v a  2s  .  c o m*/
    ex.setKeepAliveSeconds(60);
    ex.setThreadNamePrefix("defaultPool_");
    ex.afterPropertiesSet();
    return ex;
}

From source file:com.netflix.spinnaker.orca.config.JedisConfiguration.java

private static ThreadPoolTaskExecutor newFixedThreadPool(int threadPoolSize) {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(threadPoolSize);
    executor.setMaxPoolSize(threadPoolSize);
    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:com.graphaware.example.TaskExecutorConfig.java

@Bean
public AsyncTaskExecutor taskExecutor() {
    return new ThreadPoolTaskExecutor();
}

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

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

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

/**
 * Executor dedicated to searches against lucene index
 * //from w  ww  .ja va 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;
}

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);/*w  ww. j a v  a2s .co  m*/
    pool.setMaxPoolSize(10);
    pool.setWaitForTasksToCompleteOnShutdown(true);
    return pool;
}

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

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

/**.
 *///from  ww w .j ava  2 s  .  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.nayidisha.slowglow.config.SchedulerConfig.java

@Bean(name = "threadPoolTaskExecutor")
public ThreadPoolTaskExecutor threadPoolTaskExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setMaxPoolSize(5);/* w  ww.  j  a  v  a 2  s .  c o m*/
    executor.setCorePoolSize(2);
    executor.setQueueCapacity(25);
    executor.setWaitForTasksToCompleteOnShutdown(true);

    return executor;
}