You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ff...@apache.org on 2018/03/20 00:30:09 UTC

[camel] branch master updated: [CAMEL-12104]Unintuitive default cxf timeout behavior

This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new c789e1f  [CAMEL-12104]Unintuitive default cxf timeout behavior
c789e1f is described below

commit c789e1f6b09b57d1b0882268ebbe8fecfa9c05b2
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Tue Mar 20 08:29:51 2018 +0800

    [CAMEL-12104]Unintuitive default cxf timeout behavior
---
 .../src/main/java/org/apache/camel/component/cxf/CxfConsumer.java   | 6 ++++--
 .../java/org/apache/camel/component/cxf/jaxrs/CxfRsInvoker.java     | 4 ++--
 .../camel/component/cxf/CxfConsumerContinuationTimeoutTest.java     | 2 --
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
index 799f5d5..6d40a97 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
@@ -212,7 +212,7 @@ public class CxfConsumer extends DefaultConsumer {
                         }
                     });
 
-                } else if (continuation.isResumed()) {
+                } else if (!continuation.isTimeout() && continuation.isResumed()) {
                     org.apache.camel.Exchange camelExchange = (org.apache.camel.Exchange)continuation.getObject();
                     try {
                         setResponseBack(cxfExchange, camelExchange);
@@ -221,7 +221,8 @@ public class CxfConsumer extends DefaultConsumer {
                         throw ex;
                     }
 
-                } else if (!continuation.isResumed() && !continuation.isPending()) {
+                } else if (continuation.isTimeout() || 
+                    (!continuation.isResumed() && !continuation.isPending())) {
                     org.apache.camel.Exchange camelExchange = (org.apache.camel.Exchange)continuation.getObject();
                     try {
                         if (!continuation.isPending()) {
@@ -234,6 +235,7 @@ public class CxfConsumer extends DefaultConsumer {
                     }
                 }
             }
+            
             return null;
         }
 
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsInvoker.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsInvoker.java
index 29d9fa3..fef3818 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsInvoker.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsInvoker.java
@@ -104,7 +104,7 @@ public class CxfRsInvoker extends JAXRSInvoker {
                 });
                 return null;
             }
-            if (continuation.isResumed()) {
+            if (!continuation.isTimeout() && continuation.isResumed()) {
                 cxfExchange.put(SUSPENED, Boolean.FALSE);
                 org.apache.camel.Exchange camelExchange = (org.apache.camel.Exchange)continuation.getObject();
                 try {
@@ -114,7 +114,7 @@ public class CxfRsInvoker extends JAXRSInvoker {
                     throw ex;
                 }
             } else {
-                if (!continuation.isPending()) {
+                if (continuation.isTimeout() || !continuation.isPending()) {
                     cxfExchange.put(SUSPENED, Boolean.FALSE);
                     org.apache.camel.Exchange camelExchange = (org.apache.camel.Exchange)continuation.getObject();
                     camelExchange.setException(new ExchangeTimedOutException(camelExchange, endpoint.getContinuationTimeout()));
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerContinuationTimeoutTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerContinuationTimeoutTest.java
index 3ba421c..75dcf47 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerContinuationTimeoutTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerContinuationTimeoutTest.java
@@ -25,7 +25,6 @@ import org.apache.camel.Message;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.camel.util.AsyncProcessorHelper;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class CxfConsumerContinuationTimeoutTest extends CamelTestSupport {
@@ -114,7 +113,6 @@ public class CxfConsumerContinuationTimeoutTest extends CamelTestSupport {
     }
 
     @Test
-    @Ignore("CAMEL-12104")
     public void testTimeout() throws Exception {
         String out = template.requestBodyAndHeader("direct:start", "Bye World", "priority", "slow", String.class);
         assertTrue(out.contains("The OUT message was not received within: 30000 millis."));

-- 
To stop receiving notification emails like this one, please contact
ffang@apache.org.