You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2009/03/31 04:17:38 UTC

svn commit: r760293 - /servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java

Author: ffang
Date: Tue Mar 31 02:17:38 2009
New Revision: 760293

URL: http://svn.apache.org/viewvc?rev=760293&view=rev
Log:
[SMXCOMP-493]refactor to get rid of potentail memory leak

Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java?rev=760293&r1=760292&r2=760293&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java (original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java Tue Mar 31 02:17:38 2009
@@ -93,13 +93,13 @@
     
     public void process(MessageExchange exchange) throws Exception {
         Continuation cont = locks.get(exchange.getExchangeId());
+        if (cont == null) {
+            throw new Exception("HTTP request has timed out");
+        }
         if (!cont.isPending()) {
             isSTFlow = true;
         } else {
             isSTFlow = false;
-            if (cont == null) {
-                throw new Exception("HTTP request has timed out");
-            }
             synchronized (cont) {
                 if (locks.remove(exchange.getExchangeId()) == null) {
                     throw new Exception("HTTP request has timed out");
@@ -177,6 +177,11 @@
                             locks.remove(exchange.getExchangeId());
                             throw new Exception("Exchange timed out");
                         }
+                    } else {
+                        String id = (String) request.getAttribute(MessageExchange.class.getName());
+                        locks.remove(id);
+                        exchange = exchanges.remove(id);
+                        request.removeAttribute(MessageExchange.class.getName());
                     }
                 }
             } catch (RetryRequest retry) {