You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/11/03 20:27:06 UTC

[camel] 01/02: CAMEL-15795: camel-core - optimize to reduce lambda classes staying in memory

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

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

commit a8c59ee3343d6bdf7a09b9aef3367f5320278e85
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Nov 3 11:41:45 2020 +0100

    CAMEL-15795: camel-core - optimize to reduce lambda classes staying in memory
---
 .../src/main/java/org/apache/camel/spi/ConfigurerStrategy.java    | 8 ++++++--
 .../src/main/java/org/apache/camel/spi/ReifierStrategy.java       | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/ConfigurerStrategy.java b/core/camel-api/src/main/java/org/apache/camel/spi/ConfigurerStrategy.java
index e8a3ce6..36472a5 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/ConfigurerStrategy.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/ConfigurerStrategy.java
@@ -40,7 +40,9 @@ public abstract class ConfigurerStrategy {
      * (using same classloader to load this class). Clearing this map allows Camel to reduce memory footprint.
      */
     public static void clearConfigurers() {
-        CLEARERS.forEach(Runnable::run);
+        for (Runnable run : CLEARERS) {
+            run.run();
+        }
         CLEARERS.clear();
     }
 
@@ -48,7 +50,9 @@ public abstract class ConfigurerStrategy {
      * Clears the bootstrap configurers map. Clearing this map allows Camel to reduce memory footprint.
      */
     public static void clearBootstrapConfigurers() {
-        BOOTSTRAP_CLEARERS.forEach(Runnable::run);
+        for (Runnable run : BOOTSTRAP_CLEARERS) {
+            run.run();
+        }
         BOOTSTRAP_CLEARERS.clear();
     }
 
diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/ReifierStrategy.java b/core/camel-api/src/main/java/org/apache/camel/spi/ReifierStrategy.java
index 44e1ca0..615684c 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/ReifierStrategy.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/ReifierStrategy.java
@@ -35,7 +35,9 @@ public abstract class ReifierStrategy {
      * load this class). Clearing this map allows Camel to reduce memory footprint.
      */
     public static void clearReifiers() {
-        CLEARERS.forEach(Runnable::run);
+        for (Runnable run : CLEARERS) {
+            run.run();
+        }
         CLEARERS.clear();
     }