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

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


The following commit(s) were added to refs/heads/main by this push:
     new 85ba2ecd56 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=66524
85ba2ecd56 is described below

commit 85ba2ecd56e49e4e1d08a31ca86438010166821f
Author: Christopher Schultz <ch...@christopherschultz.net>
AuthorDate: Tue Mar 14 17:19:17 2023 -0400

    Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=66524
    
    Evict WebResource cache entris in LRU order as intended.
---
 java/org/apache/catalina/webresources/Cache.java | 2 +-
 webapps/docs/changelog.xml                       | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/webresources/Cache.java 
b/java/org/apache/catalina/webresources/Cache.java
index 4893a289cb..467a43bf2e 100644
--- a/java/org/apache/catalina/webresources/Cache.java
+++ b/java/org/apache/catalina/webresources/Cache.java
@@ -208,7 +208,7 @@ public class Cache {
         // used first. This is a background process so we can afford to take 
the
         // time to order the elements first
         TreeSet<CachedResource> orderedResources = new TreeSet<>(
-                
Comparator.comparingLong(CachedResource::getNextCheck).reversed());
+                Comparator.comparingLong(CachedResource::getNextCheck));
         orderedResources.addAll(resourceCache.values());
 
         Iterator<CachedResource> iter = orderedResources.iterator();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 3df44e6ca5..6eb73d1c60 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -152,6 +152,9 @@
         <code>Tomcat.addWebapp()</code> methods that incorrectly stated that 
the
         <code>docBase</code> parameter could be a relative path. (markt)
       </fix>
+      <fix>
+        <bug>66524</bug> Correct eviction ordering in WebResource cache to
+        by LRU as intended. (schultz)
     </changelog>
   </subsection>
   <subsection name="Coyote">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to