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

markt 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 37fbb5062b Optimise
37fbb5062b is described below

commit 37fbb5062b426ed1335f81b996fc96b382146640
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jan 14 07:22:46 2025 +0000

    Optimise
---
 java/org/apache/catalina/webresources/CachedResource.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/webresources/CachedResource.java 
b/java/org/apache/catalina/webresources/CachedResource.java
index 4c179547d7..0087699f6f 100644
--- a/java/org/apache/catalina/webresources/CachedResource.java
+++ b/java/org/apache/catalina/webresources/CachedResource.java
@@ -101,15 +101,12 @@ public class CachedResource implements WebResource {
             return false;
         }
 
-        long now = System.currentTimeMillis();
-
         if (webResource == null) {
             synchronized (this) {
                 if (webResource == null) {
                     webResource = root.getResourceInternal(webAppPath, 
useClassLoaderResources);
                     getLastModified();
                     getContentLength();
-                    nextCheck = ttl + now;
                     // exists() is a relatively expensive check for a file so
                     // use the fact that we know if it exists at this point
                     if (webResource instanceof EmptyResource) {
@@ -122,6 +119,8 @@ public class CachedResource implements WebResource {
             }
         }
 
+        long now = System.currentTimeMillis();
+
         if (now < nextCheck) {
             return true;
         }


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

Reply via email to