Author: ningjiang
Date: Fri Nov 5 02:11:28 2010
New Revision: 1031401
URL: http://svn.apache.org/viewvc?rev=1031401&view=rev
Log:
CAMEL-3308 revert the change of CxfConsumer so the camel-cxf can suport the CXF
2.2.x and CXF 2.3.x at the same time
Modified:
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
Modified:
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java?rev=1031401&r1=1031400&r2=1031401&view=diff
==============================================================================
---
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
(original)
+++
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
Fri Nov 5 02:11:28 2010
@@ -75,16 +75,10 @@ public class CxfConsumer extends Default
synchronized (continuation) {
if (continuation.isNew()) {
final org.apache.camel.Exchange camelExchange =
perpareCamelExchange(cxfExchange);
-
- // Now we don't set up the timeout value
- if (LOG.isTraceEnabled()) {
- LOG.trace("Suspending continuation of exchangeId:
" + camelExchange.getExchangeId());
- }
- // The continuation could be called before the suspend
is called
- continuation.suspend(0);
-
+ // TODO we need to use the CXF 2.3.0 new Continuation
API in CAMEL 3.0.0
+ // The below code should work for CXF 2.2.x and CXF
2.3.x at the same time
// use the asynchronous API to process the exchange
- getAsyncProcessor().process(camelExchange, new
AsyncCallback() {
+ boolean sync =
getAsyncProcessor().process(camelExchange, new AsyncCallback() {
public void done(boolean doneSync) {
// make sure the continuation resume will not
be called before the suspend method in other thread
synchronized (continuation) {
@@ -98,7 +92,26 @@ public class CxfConsumer extends Default
}
}
});
-
+ // just need to avoid the continuation.resume is called
+ // before the continuation.suspend is called
+ if (continuation.getObject() != camelExchange &&
!sync) {
+ // Now we don't set up the timeout value
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Suspending continuation of
exchangeId: "
+ + camelExchange.getExchangeId());
+ }
+ // The continuation could be called before the
+ // suspend is called
+ continuation.suspend(0);
+ } else {
+ // just set the response back, as the invoking
+ // thread is not changed
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Processed the Exchange : " +
camelExchange.getExchangeId());
+ }
+ setResponseBack(cxfExchange, camelExchange);
+ }
+
}
if (continuation.isResumed()) {
org.apache.camel.Exchange camelExchange =
(org.apache.camel.Exchange)continuation