From: rjung Date: Fri, 29 Oct 2010 17:47:01 +0000 (+0000) Subject: Rearrange placement of JSP limter code in JSP X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=acc3d9556fbbc83d8f7dbd818abf9cdcb34a4046;p=tomcat7.0 Rearrange placement of JSP limter code in JSP servlet wrapper. Do everything in one place: - add to the queue if this is the first time and only then check for the size and shrink if necessary - move to the front of the queue otherwise Move this in front of the actual servlet service. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1028862 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/jasper/servlet/JspServletWrapper.java b/java/org/apache/jasper/servlet/JspServletWrapper.java index 0bbbb1625..811fe1973 100644 --- a/java/org/apache/jasper/servlet/JspServletWrapper.java +++ b/java/org/apache/jasper/servlet/JspServletWrapper.java @@ -325,10 +325,6 @@ public class JspServletWrapper { // The following sets reload to true, if necessary ctxt.compile(); - - if (options.getMaxLoadedJsps() > 0) { - ctxt.getRuntimeContext().unloadJsp(); - } } } else { if (compileException != null) { @@ -375,7 +371,20 @@ public class JspServletWrapper { try { /* - * (3) Service request + * (3) Handle limitation of number of loaded Jsps + */ + if (options.getMaxLoadedJsps() > 0) { + synchronized(this) { + if (ticket == null) { + ticket = ctxt.getRuntimeContext().push(this); + ctxt.getRuntimeContext().unloadJsp(); + } else { + ctxt.getRuntimeContext().makeYoungest(ticket); + } + } + } + /* + * (4) Service request */ if (theServlet instanceof SingleThreadModel) { // sync on the wrapper so that the freshness @@ -386,14 +395,6 @@ public class JspServletWrapper { } else { theServlet.service(request, response); } - if (options.getMaxLoadedJsps() > 0) { - synchronized(this) { - if (ticket == null) - ticket = ctxt.getRuntimeContext().push(this); - else - ctxt.getRuntimeContext().makeYoungest(ticket); - } - } } catch (UnavailableException ex) { String includeRequestUri = (String) request.getAttribute("javax.servlet.include.request_uri");