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 2012/02/23 10:41:53 UTC
svn commit: r1292727 - in /camel/branches/camel-2.8.x: ./
camel-core/src/main/java/org/apache/camel/component/seda/
camel-core/src/test/java/org/apache/camel/component/seda/
Author: davsclaus
Date: Thu Feb 23 09:41:52 2012
New Revision: 1292727
URL: http://svn.apache.org/viewvc?rev=1292727&view=rev
Log:
CAMEL-5033: Seda producer in synced mode should not handover on completion tasks.
Added:
camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/component/seda/SedaWaitForTaskCompleteOnCompletionTest.java
- copied unchanged from r1292726, camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/component/seda/SedaWaitForTaskCompleteOnCompletionTest.java
camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/component/seda/SedaWaitForTaskNewerOnCompletionTest.java
- copied unchanged from r1292726, camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/component/seda/SedaWaitForTaskNewerOnCompletionTest.java
Modified:
camel/branches/camel-2.8.x/ (props changed)
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 23 09:41:52 2012
@@ -1,2 +1,2 @@
-/camel/branches/camel-2.9.x:1227549,1228229,1229567,1234054,1236672,1238942,1240157,1241006,1241489,1243052,1243058,1244875,1244877,1291871,1292116,1292389
-/camel/trunk:1226860,1227540,1228223,1229565,1234043,1236667,1238937,1240025,1240950,1240967,1241482,1243046,1243057,1244870,1244872,1291848,1292114,1292384
+/camel/branches/camel-2.9.x:1227549,1228229,1229567,1234054,1236672,1238942,1240157,1241006,1241489,1243052,1243058,1244875,1244877,1291871,1292116,1292389,1292726
+/camel/trunk:1226860,1227540,1228223,1229565,1234043,1236667,1238937,1240025,1240950,1240967,1241482,1243046,1243057,1244870,1244872,1291848,1292114,1292384,1292725
Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java?rev=1292727&r1=1292726&r2=1292727&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java (original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java Thu Feb 23 09:41:52 2012
@@ -58,12 +58,6 @@ public class SedaProducer extends Defaul
@Override
public boolean process(final Exchange exchange, final AsyncCallback callback) {
- // use a new copy of the exchange to route async and handover the on completion to the new copy
- // so its the new copy that performs the on completion callback when its done
- Exchange copy = ExchangeHelper.createCorrelatedCopy(exchange, true);
- // set a new from endpoint to be the seda queue
- copy.setFromEndpoint(endpoint);
-
WaitForTaskToComplete wait = waitForTaskToComplete;
if (exchange.getProperty(Exchange.ASYNC_WAIT) != null) {
wait = exchange.getProperty(Exchange.ASYNC_WAIT, WaitForTaskToComplete.class);
@@ -72,6 +66,9 @@ public class SedaProducer extends Defaul
if (wait == WaitForTaskToComplete.Always
|| (wait == WaitForTaskToComplete.IfReplyExpected && ExchangeHelper.isOutCapable(exchange))) {
+ // do not handover the completion as we wait for the copy to complete, and copy its result back when it done
+ Exchange copy = prepareCopy(exchange, false);
+
// latch that waits until we are complete
final CountDownLatch latch = new CountDownLatch(1);
@@ -145,6 +142,8 @@ public class SedaProducer extends Defaul
}
} else {
// no wait, eg its a InOnly then just add to queue and return
+ // handover the completion so its the copy which performs that, as we do not wait
+ Exchange copy = prepareCopy(exchange, true);
log.trace("Adding Exchange to queue: {}", copy);
addToQueue(copy);
}
@@ -155,6 +154,14 @@ public class SedaProducer extends Defaul
return true;
}
+ protected Exchange prepareCopy(Exchange exchange, boolean handover) {
+ // use a new copy of the exchange to route async
+ Exchange copy = ExchangeHelper.createCorrelatedCopy(exchange, handover);
+ // set a new from endpoint to be the seda queue
+ copy.setFromEndpoint(endpoint);
+ return copy;
+ }
+
@Override
protected void doStart() throws Exception {
super.doStart();