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

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


The following commit(s) were added to refs/heads/main by this push:
     new 74b6e1994a3 CAMEL-20231: clear the services on initialization (#12722)
74b6e1994a3 is described below

commit 74b6e1994a33fe54c3f5a5ad2acc5849148dbb16
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Tue Jan 9 15:45:29 2024 +0100

    CAMEL-20231: 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 7263f3df44a..1e90f04be21 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
@@ -204,6 +204,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);
     }
@@ -634,7 +635,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) {

Reply via email to