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

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


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

commit 72f451d68263eb401a00c10492ef8437cad416b2
Author: Nicolas Filotto <[email protected]>
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);
                 }
             }

Reply via email to