Bläddra i källkod

WhenFutureObj对象中的executorName改成executorId

everywhere.z 1 år sedan
förälder
incheckning
5da0e7bf4a

+ 12 - 13
liteflow-core/src/main/java/com/yomahub/liteflow/flow/parallel/WhenFutureObj.java

@@ -2,7 +2,6 @@ package com.yomahub.liteflow.flow.parallel;
 
 import cn.hutool.core.util.StrUtil;
 import com.yomahub.liteflow.exception.WhenTimeoutException;
-import com.yomahub.liteflow.property.LiteflowConfigGetter;
 
 /**
  * 并行异步CompletableFuture里的值对象
@@ -16,34 +15,34 @@ public class WhenFutureObj {
 
 	private boolean timeout;
 
-	private String executorName;
+	private String executorId;
 
 	private Exception ex;
 
-	public static WhenFutureObj success(String executorName) {
+	public static WhenFutureObj success(String executorId) {
 		WhenFutureObj result = new WhenFutureObj();
 		result.setSuccess(true);
 		result.setTimeout(false);
-		result.setExecutorName(executorName);
+		result.setExecutorId(executorId);
 		return result;
 	}
 
-	public static WhenFutureObj fail(String executorName, Exception ex) {
+	public static WhenFutureObj fail(String executorId, Exception ex) {
 		WhenFutureObj result = new WhenFutureObj();
 		result.setSuccess(false);
 		result.setTimeout(false);
-		result.setExecutorName(executorName);
+		result.setExecutorId(executorId);
 		result.setEx(ex);
 		return result;
 	}
 
-	public static WhenFutureObj timeOut(String executorName) {
+	public static WhenFutureObj timeOut(String executorId) {
 		WhenFutureObj result = new WhenFutureObj();
 		result.setSuccess(false);
 		result.setTimeout(true);
-		result.setExecutorName(executorName);
+		result.setExecutorId(executorId);
 		result.setEx(new WhenTimeoutException(
-				StrUtil.format("Timed out when executing the component[{}]",executorName)));
+				StrUtil.format("Timed out when executing the component[{}]",executorId)));
 		return result;
 	}
 
@@ -55,12 +54,12 @@ public class WhenFutureObj {
 		this.success = success;
 	}
 
-	public String getExecutorName() {
-		return executorName;
+	public String getExecutorId() {
+		return executorId;
 	}
 
-	public void setExecutorName(String executorName) {
-		this.executorName = executorName;
+	public void setExecutorId(String executorId) {
+		this.executorId = executorId;
 	}
 
 	public Exception getEx() {

+ 2 - 2
liteflow-core/src/main/java/com/yomahub/liteflow/flow/parallel/strategy/ParallelStrategyExecutor.java

@@ -207,7 +207,7 @@ public abstract class ParallelStrategyExecutor {
 
         // 输出超时信息
         timeOutWhenFutureObjList.forEach(whenFutureObj -> LOG.warn(
-                "executing thread has reached max-wait-seconds, thread canceled.Execute-item: [{}]", whenFutureObj.getExecutorName()));
+                "executing thread has reached max-wait-seconds, thread canceled.Execute-item: [{}]", whenFutureObj.getExecutorId()));
 
         // 当配置了 ignoreError = false,出现 interrupted 或者 !f.get() 的情况,将抛出 WhenExecuteException
         if (!whenCondition.isIgnoreError()) {
@@ -219,7 +219,7 @@ public abstract class ParallelStrategyExecutor {
             // 循环判断CompletableFuture的返回值,如果异步执行失败,则抛出相应的业务异常
             for (WhenFutureObj whenFutureObj : allCompletableWhenFutureObjList) {
                 if (!whenFutureObj.isSuccess()) {
-                    LOG.info(StrUtil.format("when-executor[{}] execute failed. errorResume [false].", whenFutureObj.getExecutorName()));
+                    LOG.info(StrUtil.format("when-executor[{}] execute failed. errorResume [false].", whenFutureObj.getExecutorId()));
                     throw whenFutureObj.getEx();
                 }
             }