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 2026/04/09 08:45:51 UTC

(camel) branch camel-4.14.x updated: CAMEL-23267: Remove outdated changes on compress (#22500)

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

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


The following commit(s) were added to refs/heads/camel-4.14.x by this push:
     new 885ef02d0af5 CAMEL-23267: Remove outdated changes on compress (#22500)
885ef02d0af5 is described below

commit 885ef02d0af5d5d945cdd828e33f4228e6630b31
Author: Nicolas Filotto <es...@users.noreply.github.com>
AuthorDate: Thu Apr 9 10:44:37 2026 +0200

    CAMEL-23267: Remove outdated changes on compress (#22500)
---
 .../src/main/java/org/apache/camel/support/cache/SimpleLRUCache.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/camel-support/src/main/java/org/apache/camel/support/cache/SimpleLRUCache.java b/core/camel-support/src/main/java/org/apache/camel/support/cache/SimpleLRUCache.java
index 29f1884a9e46..1d06e12da1b7 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/cache/SimpleLRUCache.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/cache/SimpleLRUCache.java
@@ -383,7 +383,7 @@ public class SimpleLRUCache<K, V> implements Map<K, V> {
     }
 
     /**
-     * Removes duplicates from the queue of changes if the queue is full.
+     * Removes duplicates and entries that no longer exist from the queue of changes if the queue is full.
      */
     private void compressChangesIfNeeded() {
         if (isQueueFull()) {
@@ -392,7 +392,8 @@ public class SimpleLRUCache<K, V> implements Map<K, V> {
             Set<K> keys = new HashSet<>();
             Entry<K, ValueHolder<V>> entry;
             while ((entry = currentChanges.pollLast()) != null) {
-                if (keys.add(entry.getKey())) {
+                K key = entry.getKey();
+                if (delegate.containsKey(key) && keys.add(key)) {
                     newChanges.addFirst(entry);
                 }
             }