camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1296655 - in /camel/branches/camel-2.9.x: ./ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/spi/ camel-core/src/test/java/org/apache/camel/impl/
Date Sat, 03 Mar 2012 16:08:25 GMT
Author: davsclaus
Date: Sat Mar  3 16:08:25 2012
New Revision: 1296655

URL: http://svn.apache.org/viewvc?rev=1296655&view=rev
Log:
CAMEL-4058: Fix leak in inflight registry when adding/removing a lot of routes at runtime.

Added:
    camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/impl/InflightRepositoryRemoveRouteTest.java
      - copied unchanged from r1296653, camel/trunk/camel-core/src/test/java/org/apache/camel/impl/InflightRepositoryRemoveRouteTest.java
Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultInflightRepository.java
    camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/RouteService.java
    camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/spi/InflightRepository.java

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Mar  3 16:08:25 2012
@@ -1 +1 @@
-/camel/trunk:1243046,1243057,1243234,1244518,1244644,1244859,1244861,1244864,1244870,1244872,1245021,1291555,1291727,1291848,1291864,1292114,1292384,1292725,1292760,1292767,1293079,1293268,1293288,1293330,1293590,1293828,1293852,1293855,1294130,1294482,1294502,1294533,1294588,1294639,1294709,1294909,1294976,1295073,1295108,1295120
+/camel/trunk:1243046,1243057,1243234,1244518,1244644,1244859,1244861,1244864,1244870,1244872,1245021,1291555,1291727,1291848,1291864,1292114,1292384,1292725,1292760,1292767,1293079,1293268,1293288,1293330,1293590,1293828,1293852,1293855,1294130,1294482,1294502,1294533,1294588,1294639,1294709,1294909,1294976,1295073,1295108,1295120,1296653

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultInflightRepository.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultInflightRepository.java?rev=1296655&r1=1296654&r2=1296655&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultInflightRepository.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultInflightRepository.java
Sat Mar  3 16:08:25 2012
@@ -77,6 +77,15 @@ public class DefaultInflightRepository e
         return answer != null ? answer.get() : 0;
     }
 
+    public void removeEndpoint(Endpoint endpoint) {
+        // remove endpoint if there is no current inflight
+        String key = endpoint.getEndpointKey();
+        AtomicInteger existing = endpointCount.get(key);
+        if (existing != null && existing.get() <= 0) {
+            endpointCount.remove(key);
+        }
+    }
+
     @Override
     protected void doStart() throws Exception {
     }

Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/RouteService.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/RouteService.java?rev=1296655&r1=1296654&r2=1296655&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/RouteService.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/RouteService.java
Sat Mar  3 16:08:25 2012
@@ -265,6 +265,11 @@ public class RouteService extends ChildS
         for (LifecycleStrategy strategy : camelContext.getLifecycleStrategies()) {
             strategy.onRoutesRemove(routes);
         }
+        
+        // remove the routes from the inflight registry
+        for (Route route : routes) {
+            camelContext.getInflightRepository().removeEndpoint(route.getEndpoint());
+        }
 
         // remove the routes from the collections
         camelContext.removeRouteCollection(routes);

Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/spi/InflightRepository.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/spi/InflightRepository.java?rev=1296655&r1=1296654&r2=1296655&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/spi/InflightRepository.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/spi/InflightRepository.java
Sat Mar  3 16:08:25 2012
@@ -60,4 +60,13 @@ public interface InflightRepository exte
      */
     int size(Endpoint endpoint);
 
+    /**
+     * Remove a endpoint from this registry.
+     * <p/>
+     * This is used to cleanup resources that are no longer needed.
+     *
+     * @param endpoint the endpoint to remove
+     */
+    void removeEndpoint(Endpoint endpoint);
+
 }



Mime
View raw message