You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/07/24 08:31:18 UTC
[camel] branch main updated: CAMEL-16802: Fixed
splitter/aggregate/multicast in parallel mode would not aggregate completed
task in submitted order (but use random order instead).
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new bd132ce CAMEL-16802: Fixed splitter/aggregate/multicast in parallel mode would not aggregate completed task in submitted order (but use random order instead).
bd132ce is described below
commit bd132ce4075a7f3420ad79623b5931278dc43acc
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jul 24 10:29:17 2021 +0200
CAMEL-16802: Fixed splitter/aggregate/multicast in parallel mode would not aggregate completed task in submitted order (but use random order instead).
---
.../apache/camel/processor/MulticastProcessor.java | 26 +++++++++-------------
.../camel/processor/Split123ParallelTest.java | 2 --
2 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
index 399ba2b..d125723 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
@@ -541,13 +541,7 @@ public class MulticastProcessor extends AsyncProcessorSupport
Exchange exchange = pair.getExchange();
int index = nbExchangeSent.getAndIncrement();
updateNewExchange(exchange, index, pairs, hasNext);
-
- // Schedule the processing of the next pair
- if (hasNext) {
- if (isParallelProcessing()) {
- schedule(this);
- }
- } else {
+ if (!hasNext) {
allSent.set(true);
}
@@ -593,12 +587,15 @@ public class MulticastProcessor extends AsyncProcessorSupport
}
});
});
+ // after submitting this pair then move on to the next pair (if in parallel mode)
+ if (hasNext && isParallelProcessing()) {
+ schedule(this);
+ }
} catch (Exception e) {
original.setException(e);
doDone(null, false);
}
}
-
}
/**
@@ -657,13 +654,7 @@ public class MulticastProcessor extends AsyncProcessorSupport
Exchange exchange = pair.getExchange();
int index = nbExchangeSent.getAndIncrement();
updateNewExchange(exchange, index, pairs, hasNext);
-
- // Schedule the processing of the next pair
- if (hasNext) {
- if (isParallelProcessing()) {
- schedule(this);
- }
- } else {
+ if (!hasNext) {
allSent.set(true);
}
@@ -713,6 +704,11 @@ public class MulticastProcessor extends AsyncProcessorSupport
aggregate();
});
+ // after submitting this pair then move on to the next pair (if in parallel mode)
+ if (hasNext && isParallelProcessing()) {
+ schedule(this);
+ }
+
// next step
boolean next = hasNext && !isParallelProcessing();
LOG.trace("Run next: {}", next);
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/Split123ParallelTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/Split123ParallelTest.java
index 999b148..15c6e6c 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/Split123ParallelTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/Split123ParallelTest.java
@@ -19,10 +19,8 @@ package org.apache.camel.processor;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.processor.aggregate.StringAggregationStrategy;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-@Disabled("TODO: CAMEL-16802")
public class Split123ParallelTest extends ContextTestSupport {
@Test