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

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

Introduction

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

Prototype

@Override
    public void setThreadNamePrefix(@Nullable String threadNamePrefix) 

Source Link

Usage

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

@Override
public Executor getAsyncExecutor() {

    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(20);// ww w.j a  va 2s.  com
    executor.setMaxPoolSize(50);
    executor.setQueueCapacity(500);
    executor.setThreadNamePrefix("Service-Thread");
    executor.initialize();
    return executor;
}

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

/**
 * Executor dedicated to searches against lucene index
 * //w w w  . j  av a 2s  .  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: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);//  www.  j a  v a2s . com
    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  ava2s.c  o m
    executor.setQueueCapacity(3000);
    executor.setThreadNamePrefix("EmailExecutor-");
    executor.initialize();
    return executor;
}

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

/**
 * executor dedicated to searches against in memory index
 * /* w  ww  .  jav  a 2s.c om*/
 * @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:cn.org.once.cstack.config.AsyncConfiguration.java

@Override
@Bean/*from  w  w  w. j av a  2s .co 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);//from   ww w  . java 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);/*w  ww  . ja  v a2  s. c om*/
    executor.setThreadNamePrefix("ASYNCHRONOUS-ANNOTATION-EXECUTOR-");
    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   www .j  a  v a  2 s.  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: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  .j a  v  a2  s . co  m*/
    executor.setMaxPoolSize(42);
    executor.setQueueCapacity(11);
    executor.setThreadNamePrefix("EditorExecutor-");
    executor.initialize();

    return executor;
}