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

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

Introduction

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

Prototype

public void setWaitForTasksToCompleteOnShutdown(boolean waitForJobsToCompleteOnShutdown) 

Source Link

Document

Set whether to wait for scheduled tasks to complete on shutdown, not interrupting running tasks and executing all tasks in the queue.

Usage

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

@Override
@Bean/*from   w  w w  .j  a  v 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.teradata.benchto.driver.DriverApp.java

@Bean
public ThreadPoolTaskExecutor defaultTaskExecutor() {
    ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
    taskExecutor.setMaxPoolSize(5);//  w  ww .  j  a  v a 2 s .  c om
    taskExecutor.setWaitForTasksToCompleteOnShutdown(true);
    taskExecutor.setAwaitTerminationSeconds(300);

    return taskExecutor;
}

From source file:com.apress.prospringintegration.concurrency.taskexecutorexample.TaskExecutorExampleConfiguration.java

@Bean
public ThreadPoolTaskExecutor threadPoolTaskExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(50);/*from   w  w w.j  a v  a2s .  com*/
    executor.setDaemon(false);
    executor.setWaitForTasksToCompleteOnShutdown(true);
    executor.setMaxPoolSize(100);
    executor.setAllowCoreThreadTimeOut(true);
    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  w w .  j a v  a2  s .  co m*/
    executor.setCorePoolSize(2);
    executor.setQueueCapacity(25);
    executor.setWaitForTasksToCompleteOnShutdown(true);

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

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

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

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

From source file:org.schedoscope.metascope.config.TaskConfiguration.java

@Bean
public TaskExecutor asyncTaskExecutor() {
    ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
    threadPoolTaskExecutor.setCorePoolSize(10);
    threadPoolTaskExecutor.setMaxPoolSize(10);
    threadPoolTaskExecutor.setWaitForTasksToCompleteOnShutdown(true);
    return threadPoolTaskExecutor;
}

From source file:burstcoin.jminer.core.CoreConfig.java

/**
 * Reader pool./*from ww  w  . java  2s. co  m*/
 *
 * @return the thread pool task executor
 */
@Bean(name = "readerPool")
public ThreadPoolTaskExecutor readerPool() {
    ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
    pool.setThreadPriority(Thread.NORM_PRIORITY);
    // false-> triggers interrupt exception at shutdown
    pool.setWaitForTasksToCompleteOnShutdown(true);
    return pool;
}

From source file:org.ng200.openolympus.Application.java

@Bean
public ThreadPoolTaskExecutor taskExecutor() {
    final ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
    pool.setCorePoolSize(5);//from   w ww. ja va 2  s. c o m
    pool.setMaxPoolSize(10);
    pool.setWaitForTasksToCompleteOnShutdown(true);
    return pool;
}