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

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


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

commit c9b202aad8f351e60f7f6e5a02db3691a97c4059
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 cc544b22b1..5cbbdfaebb 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -128,6 +128,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