diff --git a/src/main/java/com/igot/cb/pores/config/AsyncConfig.java b/src/main/java/com/igot/cb/pores/config/AsyncConfig.java index dc791ca..702b93e 100644 --- a/src/main/java/com/igot/cb/pores/config/AsyncConfig.java +++ b/src/main/java/com/igot/cb/pores/config/AsyncConfig.java @@ -1,5 +1,7 @@ package com.igot.cb.pores.config; +import com.igot.cb.pores.util.CbServerProperties; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableAsync; @@ -8,15 +10,16 @@ @Configuration @EnableAsync public class AsyncConfig { + @Autowired + private CbServerProperties cbServerProperties; @Bean public ThreadPoolTaskExecutor taskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - executor.setCorePoolSize(10); - executor.setMaxPoolSize(20); - executor.setQueueCapacity(500); + executor.setCorePoolSize(cbServerProperties.getAsyncThreadPoolSize()); + executor.setMaxPoolSize(cbServerProperties.getAsyncThreadMaxPoolSize()); executor.setThreadNamePrefix("async-"); executor.initialize(); return executor; diff --git a/src/main/java/com/igot/cb/pores/util/CbServerProperties.java b/src/main/java/com/igot/cb/pores/util/CbServerProperties.java index 3c72d2b..fb6fe09 100644 --- a/src/main/java/com/igot/cb/pores/util/CbServerProperties.java +++ b/src/main/java/com/igot/cb/pores/util/CbServerProperties.java @@ -40,4 +40,10 @@ public class CbServerProperties { @Value("${cloud.storage.endpoint}") private String cloudStorageEndpoint; + @Value("${async.thread.pool.size}") + private int asyncThreadPoolSize; + + @Value("${async.thread.max.pool.size}") + private int asyncThreadMaxPoolSize; + } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 2f6d245..e07d7d5 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -58,4 +58,7 @@ cloud.storage.endpoint=endpoint discussion.cloud.folder.name=discussionhub discussion.container.name=igot +async.thread.pool.size=10 +async.thread.max.pool.size=50 + accesstoken.publickey.basepath= \ No newline at end of file