Author: gnodet
Date: Thu Sep  6 05:48:56 2007
New Revision: 573248

URL: http://svn.apache.org/viewvc?rev=573248&view=rev
Log:
Fix SM-1050 and SM-1035

Modified:
    
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java

Modified: 
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java
URL: 
http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java?rev=573248&r1=573247&r2=573248&view=diff
==============================================================================
--- 
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java
 (original)
+++ 
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java
 Thu Sep  6 05:48:56 2007
@@ -219,26 +219,25 @@
             // Not giving a specific mutex will synchronize on the 
continuation itself
             Continuation cont = ContinuationSupport.getContinuation(request, 
null);
             // If the continuation is not a retry
-            if (!cont.isPending()) {
+            if (!cont.isPending() && cont.isNew()) {
                 exchange = createExchange(request);
                 locks.put(exchange.getExchangeId(), cont);
                 request.setAttribute(MessageExchange.class.getName(), 
exchange.getExchangeId());
                 synchronized (cont) {
                     send(exchange);
-                    if (exchanges.remove(exchange.getExchangeId()) == null) {
-                        if (logger.isDebugEnabled()) {
-                            logger.debug("Suspending continuation for 
exchange: " + exchange.getExchangeId());
-                        }
-                        long to = this.timeout;
-                        if (to == 0) {
-                            to = ((HttpComponent) 
getServiceUnit().getComponent()).getConfiguration()
+                    if (logger.isDebugEnabled()) {
+                        logger.debug("Suspending continuation for exchange: " 
+ exchange.getExchangeId());
+                    }
+                    long to = this.timeout;
+                    if (to == 0) {
+                        to = ((HttpComponent) 
getServiceUnit().getComponent()).getConfiguration()
                                             .getConsumerProcessorSuspendTime();
-                        }
-                        boolean result = cont.suspend(to);
-                        if (!result) {
-                            locks.remove(exchange.getExchangeId());
-                            throw new Exception("Exchange timed out");
-                        }
+                    }
+                    boolean result = cont.suspend(to);
+                    exchanges.remove(exchange.getExchangeId();
+                    if (!result) {
+                        locks.remove(exchange.getExchangeId());
+                        throw new Exception("Exchange timed out");
                     }
                     request.removeAttribute(MessageExchange.class.getName());
                 }


Reply via email to