diff --git a/pom.xml b/pom.xml
index a799dc9..54adee1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.jd.platform
asyncTool
- 1.0-SNAPSHOT
+ 1.3.1-SNAPSHOT
diff --git a/src/main/java/com/jd/platform/async/executor/Async.java b/src/main/java/com/jd/platform/async/executor/Async.java
index ee2c4e6..fbb45a4 100644
--- a/src/main/java/com/jd/platform/async/executor/Async.java
+++ b/src/main/java/com/jd/platform/async/executor/Async.java
@@ -24,15 +24,10 @@ public class Async {
new LinkedBlockingQueue<>(),
(ThreadFactory) Thread::new);
- /**
- * 如果想自定义线程池,请传pool。不自定义的话,就走默认的COMMON_POOL
- */
- public static boolean beginWork(long timeout, ThreadPoolExecutor pool, WorkerWrapper... workerWrapper) throws ExecutionException, InterruptedException {
- if(workerWrapper == null || workerWrapper.length == 0) {
+ public static boolean beginWork(long timeout, ThreadPoolExecutor pool, List workerWrappers) throws ExecutionException, InterruptedException {
+ if(workerWrappers == null || workerWrappers.size() == 0) {
return false;
}
- List workerWrappers = Arrays.stream(workerWrapper).collect(Collectors.toList());
-
CompletableFuture[] futures = new CompletableFuture[workerWrappers.size()];
for (int i = 0; i < workerWrappers.size(); i++) {
WorkerWrapper wrapper = workerWrappers.get(i);
@@ -51,6 +46,17 @@ public class Async {
}
}
+ /**
+ * 如果想自定义线程池,请传pool。不自定义的话,就走默认的COMMON_POOL
+ */
+ public static boolean beginWork(long timeout, ThreadPoolExecutor pool, WorkerWrapper... workerWrapper) throws ExecutionException, InterruptedException {
+ if(workerWrapper == null || workerWrapper.length == 0) {
+ return false;
+ }
+ List workerWrappers = Arrays.stream(workerWrapper).collect(Collectors.toList());
+ return beginWork(timeout, pool, workerWrappers);
+ }
+
/**
* 同步阻塞,直到所有都完成,或失败
*/