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:Main.java

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

From source file:org.mimacom.sample.integration.patterns.user.service.integration.AsyncSearchServiceIntegration.java

private static AsyncRestTemplate initializeRestTemplate() {
    ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
    threadPoolTaskExecutor.setCorePoolSize(2);
    threadPoolTaskExecutor.setMaxPoolSize(2);
    threadPoolTaskExecutor.setThreadNamePrefix("SearchServiceIntegration-");
    threadPoolTaskExecutor.afterPropertiesSet();

    return new AsyncRestTemplate(threadPoolTaskExecutor);
}

From source file:org.mimacom.sample.integration.patterns.user.service.integration.BulkHeadedSearchServiceIntegration.java

private static AsyncRestTemplate initializeRestTemplate(String threadNamePrefix) {
    ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
    threadPoolTaskExecutor.setCorePoolSize(2);
    threadPoolTaskExecutor.setMaxPoolSize(2);
    threadPoolTaskExecutor.setThreadNamePrefix(threadNamePrefix);
    threadPoolTaskExecutor.afterPropertiesSet();

    return new AsyncRestTemplate(threadPoolTaskExecutor);
}

From source file:zipkin.autoconfigure.storage.mysql.ZipkinMySQLStorageAutoConfiguration.java

@Bean
@ConditionalOnMissingBean(Executor.class)
Executor executor() {//  w w  w  .j  ava 2  s  .  co m
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setThreadNamePrefix("ZipkinMySQLStorage-");
    executor.initialize();
    return executor;
}

From source file:zipkin.autoconfigure.storage.mysql.brave.TraceZipkinMySQLStorageAutoConfiguration.java

@Bean
@ConditionalOnMissingBean(Executor.class)
public Executor executor(ServerSpanState serverState) {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setThreadNamePrefix("MySQLStorage-");
    executor.initialize();/*from   w ww.  j  a va2s .c o  m*/
    return command -> {
        ServerSpan currentSpan = serverState.getCurrentServerSpan();
        executor.execute(() -> {
            serverState.setCurrentServerSpan(currentSpan);
            command.run();
        });
    };
}

From source file:com.google.cloud.trace.zipkin.autoconfigure.ZipkinStackdriverStorageAutoConfiguration.java

@Bean(name = "stackdriverExecutor")
@ConditionalOnMissingBean(Executor.class)
Executor executor() {/*ww  w  . j  a  va 2s .  c  om*/
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setThreadNamePrefix("ZipkinStackdriverStorage-");
    executor.setCorePoolSize(storageProperties.getExecutor().getCorePoolSize());
    executor.setMaxPoolSize(storageProperties.getExecutor().getMaxPoolSize());
    executor.setQueueCapacity(storageProperties.getExecutor().getQueueCapacity());
    executor.initialize();

    log.info("Configured Executor for ZipkinStackDriver Storage with: {}", storageProperties.getExecutor());
    return executor;
}

From source file:net.brainage.nest.NestApplication.java

@Bean
public AsyncTaskExecutor asyncTaskExecutor() {
    ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
    taskExecutor.setCorePoolSize(5);/*from www . j a v a2 s. c o m*/
    taskExecutor.setMaxPoolSize(200);
    taskExecutor.setQueueCapacity(100);
    taskExecutor.setThreadNamePrefix("async-task-executor-");
    taskExecutor.initialize();
    return taskExecutor;
}

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

/**.
 *//*from ww  w  .  j a  va  2 s .co  m*/
@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:ch.javaee.basicMvc.config.SchedulingConfig.java

@Override
public Executor getAsyncExecutor() {
    logger.debug("Enter: getAsynchExecutor");
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(7);/*ww  w.  j av  a  2 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.aol.advertising.qiao.agent.DataDisruptor.java

public void init() throws IOException {

    if (!CommonUtils.isPowerOfTwo(capacity))
        capacity = CommonUtils.power2(capacity);

    if (waitStrategy == null)
        waitStrategy = new BlockingWaitStrategy();

    //disruptor = new Disruptor<EventWrapper>(EventWrapper.EVENT_FACTORY,
    //        capacity, Executors.newCachedThreadPool(), ProducerType.SINGLE,
    //        waitStrategy);

    ThreadPoolTaskExecutor executor = CommonUtils.createFixedThreadPoolExecutor(threadPoolSize);
    executor.setThreadNamePrefix(this.getClass().getSimpleName());
    executor.initialize();// w  w  w.  jav  a  2  s.  c o  m

    disruptor = new Disruptor<EventWrapper>(EventWrapper.EVENT_FACTORY, capacity, executor, ProducerType.SINGLE,
            waitStrategy);

    disruptor.handleEventsWith(eventHandlerList.toArray(new EventHandler[0]));
}