|
|
|
@@ -1,6 +1,5 @@ |
|
|
|
package com.iformall.service.thread; |
|
|
|
|
|
|
|
import com.alibaba.ttl.threadpool.TtlExecutors; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
@@ -29,10 +28,10 @@ public class CompletableFutureWithExecutor { |
|
|
|
} |
|
|
|
|
|
|
|
public static <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier) { |
|
|
|
return CompletableFuture.supplyAsync(supplier, TtlExecutors.getTtlExecutorService(future.threadPoolService.getExecutorService(CORE_SIZE, MAX_SIZE))); |
|
|
|
return CompletableFuture.supplyAsync(supplier, future.threadPoolService.getExecutorService(CORE_SIZE, MAX_SIZE)); |
|
|
|
} |
|
|
|
|
|
|
|
public static CompletableFuture<Void> runAsync(Runnable runnable) { |
|
|
|
return CompletableFuture.runAsync(runnable, TtlExecutors.getTtlExecutorService(future.threadPoolService.getExecutorService(CORE_SIZE, MAX_SIZE))); |
|
|
|
return CompletableFuture.runAsync(runnable, future.threadPoolService.getExecutorService(CORE_SIZE, MAX_SIZE)); |
|
|
|
} |
|
|
|
} |