package com.box.l10n.mojito;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.AdviceMode;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.scheduling.annotation.AsyncConfigurerSupport;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.security.task.DelegatingSecurityContextAsyncTaskExecutor;
import java.util.concurrent.Executor;

/**
 *
 * @author jaurambault
 */
@Configuration
@EnableAsync(mode = AdviceMode.ASPECTJ)
public class AsyncConfig extends AsyncConfigurerSupport {

    /**
     * When using aspectJ + @EnableAsync, there is no default executor. Need to
     * create one.
     *
     * @return
     */
    @Override
    public Executor getAsyncExecutor() {
        ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
        threadPoolTaskExecutor.setBeanName("asyncExecutor");
        threadPoolTaskExecutor.setCorePoolSize(5);
        threadPoolTaskExecutor.setMaxPoolSize(10);
        threadPoolTaskExecutor.initialize();
        return threadPoolTaskExecutor;
    }

    @Bean
    @Qualifier("pollableTaskExecutor")
    public AsyncTaskExecutor getPollableTaskExecutor() {
        ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
        threadPoolTaskExecutor.setBeanName("pollableTask");
        threadPoolTaskExecutor.setCorePoolSize(5);
        threadPoolTaskExecutor.setMaxPoolSize(10);
        threadPoolTaskExecutor.initialize();

        return new DelegatingSecurityContextAsyncTaskExecutor(threadPoolTaskExecutor);
    }

}

@@ -1666,33 +1666,33 @@
 .setMaxPoolSize(
-1
+3
 0);%0A        thre

Increase Pollable thread pool size