feature #I7HJFX 为异步循环添加测试用例,添加异步循环相关配置参数的读取代码

This commit is contained in:
zy
2023-07-03 20:48:12 +08:00
parent 25a99a97d1
commit be68ceedec
24 changed files with 584 additions and 3 deletions

View File

@@ -98,6 +98,16 @@ public class IteratorCondition extends LoopCondition {
}
index++;
}
//等待所有的异步执行完毕
CompletableFuture<?> resultCompletableFuture = CompletableFuture.allOf(futureList.toArray(new CompletableFuture[]{}));
resultCompletableFuture.join();
//获取所有的执行结果,如果有失败的,那么需要抛出异常
for (CompletableFuture<LoopFutureObj> future : futureList) {
LoopFutureObj loopFutureObj = future.get();
if (!loopFutureObj.isSuccess()) {
throw loopFutureObj.getEx();
}
}
}
} finally {
removeLoopIndex(executableItem);

View File

@@ -420,7 +420,11 @@ public class LiteflowConfig {
}
public Integer getParallelMaxWorkers() {
return parallelMaxWorkers;
if(ObjectUtil.isNull(parallelMaxWorkers)){
return 16;
}else{
return parallelMaxWorkers;
}
}
public void setParallelMaxWorkers(Integer parallelMaxWorkers) {
@@ -428,7 +432,11 @@ public class LiteflowConfig {
}
public Integer getParallelQueueLimit() {
return parallelQueueLimit;
if(ObjectUtil.isNull(parallelQueueLimit)){
return 512;
}else{
return parallelQueueLimit;
}
}
public void setParallelQueueLimit(Integer parallelQueueLimit) {

View File

@@ -22,6 +22,6 @@ public class LiteFlowDefaultParallelLoopExecutorBuilder implements ExecutorBuild
liteflowConfig = new LiteflowConfig();
}
return buildDefaultExecutor(liteflowConfig.getParallelMaxWorkers(), liteflowConfig.getParallelMaxWorkers(),
liteflowConfig.getParallelQueueLimit(), "parallel-loop-thead-");
liteflowConfig.getParallelQueueLimit(), "loop-thead-");
}
}