wangwei 5 жил өмнө
parent
commit
448449a729

+ 3 - 1
src/main/java/cn/com/qmth/examcloud/commons/helpers/pipeline/NodeExecuter.java

@@ -1,5 +1,7 @@
 package cn.com.qmth.examcloud.commons.helpers.pipeline;
 
+import java.util.List;
+
 import cn.com.qmth.examcloud.commons.helpers.KeyValuePair;
 
 /**
@@ -15,7 +17,7 @@ import cn.com.qmth.examcloud.commons.helpers.KeyValuePair;
  */
 public interface NodeExecuter<KEYIN, VALUEIN, KEYOUT, VALUEOUT> {
 
-	KeyValuePair<KEYOUT, VALUEOUT> execute(KEYIN key, VALUEIN value, TaskContext context)
+	List<KeyValuePair<KEYOUT, VALUEOUT>> execute(KEYIN key, VALUEIN value, TaskContext context)
 			throws Exception;
 
 }

+ 6 - 3
src/main/java/cn/com/qmth/examcloud/commons/helpers/pipeline/SimpleNode.java

@@ -1,5 +1,6 @@
 package cn.com.qmth.examcloud.commons.helpers.pipeline;
 
+import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
@@ -122,10 +123,12 @@ public class SimpleNode<KEYIN, VALUEIN, KEYOUT, VALUEOUT>
 						.append(null == value ? null : value.toString()).toString());
 			}
 			counter.incrementTotal();
-			KeyValuePair<KEYOUT, VALUEOUT> out = executer.execute(key, value, context);
+			List<KeyValuePair<KEYOUT, VALUEOUT>> outList = executer.execute(key, value, context);
 
-			if (null != out && null != getLowerStorer()) {
-				getLowerStorer().putElement(out.getKey(), out.getValue());
+			if (null != outList && null != getLowerStorer()) {
+				for (KeyValuePair<KEYOUT, VALUEOUT> pair : outList) {
+					getLowerStorer().putElement(pair.getKey(), pair.getValue());
+				}
 			}
 
 			getStorer().remove(key);