This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 96995f9f32 Review "Record JSP usage time on every request, fixing
premature..."
96995f9f32 is described below
commit 96995f9f325b3f3986c8d7a191ac1aec245c55d2
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Nov 6 09:51:05 2026 +0000
Review "Record JSP usage time on every request, fixing premature..."
Fix concurrency issue tracking last queue update time
---
java/org/apache/jasper/servlet/JspServletWrapper.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/jasper/servlet/JspServletWrapper.java
b/java/org/apache/jasper/servlet/JspServletWrapper.java
index 699f4b5444..82e838af06 100644
--- a/java/org/apache/jasper/servlet/JspServletWrapper.java
+++ b/java/org/apache/jasper/servlet/JspServletWrapper.java
@@ -86,6 +86,8 @@ public class JspServletWrapper {
private volatile long servletClassLastModifiedTime;
private long lastModificationTest = 0L;
private long lastUsageTime = System.currentTimeMillis();
+ // Background unload cycle last observed by this wrapper's queue entry.
+ private long lastJspQueueUpdate;
private FastRemovalDequeue<JspServletWrapper>.Entry unloadHandle;
private final boolean unloadAllowed;
private final boolean unloadByCount;
@@ -480,13 +482,15 @@ public class JspServletWrapper {
if (unloadAllowed) {
synchronized (this) {
if (unloadByCount) {
+ long jspQueueUpdate =
ctxt.getRuntimeContext().getLastJspQueueUpdate();
if (unloadHandle == null) {
unloadHandle = ctxt.getRuntimeContext().push(this);
- } else if (lastUsageTime <
ctxt.getRuntimeContext().getLastJspQueueUpdate()) {
+ } else if (lastJspQueueUpdate != jspQueueUpdate) {
// Limit queue re-ordering to a single move per
// background checkUnload() cycle.
ctxt.getRuntimeContext().makeYoungest(unloadHandle);
}
+ lastJspQueueUpdate = jspQueueUpdate;
}
// Always record the usage time, so an actively used JSP is
// never seen as idle by checkUnload(), independent of how
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]