You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/10/08 13:32:21 UTC

svn commit: r702812 - in /servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http: endpoints/HttpConsumerEndpoint.java processors/ConsumerProcessor.java

Author: gnodet
Date: Wed Oct  8 04:32:21 2008
New Revision: 702812

URL: http://svn.apache.org/viewvc?rev=702812&view=rev
Log:
SM-1407: fix problem when resuming the continuation fails

Modified:
    servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java
    servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java

Modified: servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java?rev=702812&r1=702811&r2=702812&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java (original)
+++ servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java Wed Oct  8 04:32:21 2008
@@ -251,6 +251,13 @@
             exchanges.put(exchange.getExchangeId(), exchange);
             // Resume continuation
             cont.resume();
+            if (!cont.isResumed()) {
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Could not resume continuation for exchange: " + exchange.getExchangeId());
+                }
+                exchanges.remove(exchange.getExchangeId());
+                throw new Exception("HTTP request has timed out for exchange: " + exchange.getExchangeId());
+            }
         }
     }
 
@@ -332,9 +339,9 @@
                         throw new IllegalStateException("Exchange not found");
                     }
                     if (!cont.isResumed()) {
-                        Exception e = new Exception("Exchange timed out: " + exchange.getExchangeId());
-                        fail(exchange, e);
-                        throw e;
+                        // When the exchange comes back later, the continuation will not be found and
+                        // the exchange will be set in an ERROR state by the process(MessageExchange) method
+                        throw new Exception("Exchange timed out: " + exchange.getExchangeId());
                     }
                 }
             }

Modified: servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java?rev=702812&r1=702811&r2=702812&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java (original)
+++ servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java Wed Oct  8 04:32:21 2008
@@ -104,6 +104,13 @@
             }
             exchanges.put(exchange.getExchangeId(), exchange);
             cont.resume();
+            if (!cont.isResumed()) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Could not resume continuation for exchange: " + exchange.getExchangeId());
+                }
+                exchanges.remove(exchange.getExchangeId());
+                throw new Exception("HTTP request has timed out for exchange: " + exchange.getExchangeId());
+            }
         }
     }
 
@@ -192,8 +199,6 @@
                 }
                 if (!cont.isResumed()) {
                     Exception e = new Exception("Exchange timed out: " + exchange.getExchangeId());
-                    exchange.setError(e);
-                    channel.send(exchange);
                     sendFault(new SoapFault(e), request, response);
                     return;
                 }