From 74b6e1994a33fe54c3f5a5ad2acc5849148dbb16 Mon Sep 17 00:00:00 2001 From: Otavio Rodolfo Piske Date: Tue, 9 Jan 2024 15:45:29 +0100 Subject: [PATCH] CAMEL-20231: clear the services on initialization (#12722) This should prevent running out of memory due to constantly increasing the service list --- .../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 7263f3df44a10..1e90f04be211f 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 String getSourceLocationShort() { @Override public void initializeServices() throws Exception { + services.clear(); // gather all the services for this route gatherServices(services); } @@ -634,7 +635,7 @@ protected void gatherServices(List services) throws Exception { } } - protected void gatherRootServices(List services) throws Exception { + private void gatherRootServices(List services) throws Exception { Endpoint endpoint = getEndpoint(); consumer = endpoint.createConsumer(processor); if (consumer != null) {