You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2024/01/10 09:24:24 UTC

(camel) branch camel-4.0.x updated: CAMEL-20301: clear the services on initialization (#12722)

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

orpiske pushed a commit to branch camel-4.0.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.0.x by this push:
     new 09fe1c68687 CAMEL-20301: clear the services on initialization (#12722)
09fe1c68687 is described below

commit 09fe1c686879a2fd5c51d6294479000b9c314542
Author: Otavio Rodolfo Piske <or...@users.noreply.github.com>
AuthorDate: Tue Jan 9 15:45:29 2024 +0100

    CAMEL-20301: clear the services on initialization (#12722)
    
    This should prevent running out of memory due to constantly increasing the service list
---
 .../src/main/java/org/apache/camel/impl/engine/DefaultRoute.java       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java
index 216577726d4..80fe61c2849 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java
@@ -201,6 +201,7 @@ public class DefaultRoute extends ServiceSupport implements Route {
 
     @Override
     public void initializeServices() throws Exception {
+        services.clear();
         // gather all the services for this route
         gatherServices(services);
     }
@@ -631,7 +632,7 @@ public class DefaultRoute extends ServiceSupport implements Route {
         }
     }
 
-    protected void gatherRootServices(List<Service> services) throws Exception {
+    private void gatherRootServices(List<Service> services) throws Exception {
         Endpoint endpoint = getEndpoint();
         consumer = endpoint.createConsumer(processor);
         if (consumer != null) {