This is an automated email from the ASF dual-hosted git repository. schultz pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new 4823dc6f50 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=66524 4823dc6f50 is described below commit 4823dc6f5095854c7236760cd859a44bdf4fd909 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 | 12 +++--------- webapps/docs/changelog.xml | 3 +++ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/java/org/apache/catalina/webresources/Cache.java b/java/org/apache/catalina/webresources/Cache.java index bfa1b2199e..2586cb5805 100644 --- a/java/org/apache/catalina/webresources/Cache.java +++ b/java/org/apache/catalina/webresources/Cache.java @@ -326,15 +326,9 @@ public class Cache { long nc1 = cr1.getNextCheck(); long nc2 = cr2.getNextCheck(); - // Oldest resource should be first (so iterator goes from oldest to - // youngest. - if (nc1 == nc2) { - return 0; - } else if (nc1 > nc2) { - return -1; - } else { - return 1; - } + // Oldest resource (lowest next-check value) should be first (so + // iterator goes from oldest to youngest. + return Long.compare(nc1, nc2); } } } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index a1d8e010d8..9b8b070a20 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