BAEL-442 Making some changes to how many threads are in the executors. Cleaning up some white space.

This commit is contained in:
tschiman 2017-01-11 21:59:38 -07:00
parent f221faca4c
commit fa63fae6fc
2 changed files with 13 additions and 17 deletions

View File

@ -65,7 +65,4 @@ public class SleuthController {
logger.info("After Async Method Call"); logger.info("After Async Method Call");
return "success"; return "success";
} }
} }

View File

@ -25,12 +25,22 @@ public class ThreadConfig extends AsyncConfigurerSupport implements SchedulingCo
@Bean @Bean
public Executor executor() { public Executor executor() {
return makeExecutor(); ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
threadPoolTaskExecutor.setCorePoolSize(1);
threadPoolTaskExecutor.setMaxPoolSize(1);
threadPoolTaskExecutor.initialize();
return new LazyTraceExecutor(beanFactory, threadPoolTaskExecutor);
} }
@Override @Override
public Executor getAsyncExecutor() { public Executor getAsyncExecutor() {
return makeExecutor(); ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
threadPoolTaskExecutor.setCorePoolSize(1);
threadPoolTaskExecutor.setMaxPoolSize(1);
threadPoolTaskExecutor.initialize();
return new LazyTraceExecutor(beanFactory, threadPoolTaskExecutor);
} }
@Override @Override
@ -40,17 +50,6 @@ public class ThreadConfig extends AsyncConfigurerSupport implements SchedulingCo
@Bean(destroyMethod = "shutdown") @Bean(destroyMethod = "shutdown")
public Executor schedulingExecutor() { public Executor schedulingExecutor() {
return Executors.newScheduledThreadPool(100); return Executors.newScheduledThreadPool(1);
} }
private Executor makeExecutor() {
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
threadPoolTaskExecutor.setCorePoolSize(5);
threadPoolTaskExecutor.setMaxPoolSize(10);
threadPoolTaskExecutor.initialize();
return new LazyTraceExecutor(beanFactory, threadPoolTaskExecutor);
}
} }