diff --git a/mallinkService/src/main/java/com/iformall/service/thread/CompletableFutureWithExecutor.java b/mallinkService/src/main/java/com/iformall/service/thread/CompletableFutureWithExecutor.java index eca28b815..6943e568b 100644 --- a/mallinkService/src/main/java/com/iformall/service/thread/CompletableFutureWithExecutor.java +++ b/mallinkService/src/main/java/com/iformall/service/thread/CompletableFutureWithExecutor.java @@ -27,7 +27,7 @@ public class CompletableFutureWithExecutor { future = this; } - public static CompletableFuture supplyAsync(Supplier supplier) { + public static CompletableFuture supplyAsync(Supplier supplier) { return CompletableFuture.supplyAsync(supplier, future.threadPoolService.getExecutorService(CORE_SIZE, MAX_SIZE)); } diff --git a/mallinkService/src/main/java/com/iformall/service/thread/ThreadPoolService.java b/mallinkService/src/main/java/com/iformall/service/thread/ThreadPoolService.java index 378557214..c79a7ee8a 100644 --- a/mallinkService/src/main/java/com/iformall/service/thread/ThreadPoolService.java +++ b/mallinkService/src/main/java/com/iformall/service/thread/ThreadPoolService.java @@ -14,8 +14,8 @@ import java.util.concurrent.atomic.AtomicInteger; @Component public class ThreadPoolService { - private final Integer coreSize = 2; - private final Integer maxSize = 2 * Runtime.getRuntime().availableProcessors(); + private static final Integer CORE_SIZE = 2; + private static Integer MAX_SIZE = 2 * Runtime.getRuntime().availableProcessors(); private final String prefix = "fm-thread-pool-"; private final AtomicInteger nextId = new AtomicInteger(); @@ -26,7 +26,7 @@ public class ThreadPoolService { private volatile ThreadPoolExecutor service; private ThreadPoolService() { - getExecutorService(Integer.MAX_VALUE, Integer.MAX_VALUE); + getExecutorService(CORE_SIZE, MAX_SIZE); } /**