You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2025/01/14 08:00:37 UTC
(tomcat) 02/02: Optimise
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit ce607821e1043fe4e7f442a0e10369248b80c13b
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 c71807255d..7a729048dd 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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org