Search in sources :

Example 1 with MicaAsyncTaskExecutor

use of org.obiba.mica.core.MicaAsyncTaskExecutor in project mica2 by obiba.

the class AsyncConfiguration method getOpalAsyncExecutor.

@Bean(name = "opalExecutor")
public Executor getOpalAsyncExecutor() {
    log.debug("Creating Async Task Executor");
    Integer poolSize = propertyResolver.getProperty("opal.poolSize", Integer.class, DEFAULT_POOL_SIZE);
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(poolSize);
    executor.setMaxPoolSize(poolSize);
    executor.setQueueCapacity(propertyResolver.getProperty("opal.queueCapacity", Integer.class, DEFAULT_QUEUE_CAPACITY));
    executor.setThreadNamePrefix("mica-opal-executor-");
    return new MicaAsyncTaskExecutor(executor);
}
Also used : MicaAsyncTaskExecutor(org.obiba.mica.core.MicaAsyncTaskExecutor) ThreadPoolTaskExecutor(org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor) Bean(org.springframework.context.annotation.Bean)

Example 2 with MicaAsyncTaskExecutor

use of org.obiba.mica.core.MicaAsyncTaskExecutor in project mica2 by obiba.

the class AsyncConfiguration method getAsyncExecutor.

@Override
@Bean
public Executor getAsyncExecutor() {
    Integer poolSize = propertyResolver.getProperty("poolSize", Integer.class, DEFAULT_POOL_SIZE);
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(poolSize);
    executor.setMaxPoolSize(poolSize);
    executor.setQueueCapacity(propertyResolver.getProperty("queueCapacity", Integer.class, DEFAULT_QUEUE_CAPACITY));
    executor.setThreadNamePrefix("mica-executor-");
    return new MicaAsyncTaskExecutor(executor);
}
Also used : MicaAsyncTaskExecutor(org.obiba.mica.core.MicaAsyncTaskExecutor) ThreadPoolTaskExecutor(org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor) Bean(org.springframework.context.annotation.Bean)

Aggregations

MicaAsyncTaskExecutor (org.obiba.mica.core.MicaAsyncTaskExecutor)2 Bean (org.springframework.context.annotation.Bean)2 ThreadPoolTaskExecutor (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor)2