Author: rjung Date: Fri Oct 29 17:47:01 2010 New Revision: 1028862 URL: http://svn.apache.org/viewvc?rev=1028862&view=rev Log: 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. Modified: tomcat/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java Modified: tomcat/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java?rev=1028862&r1=1028861&r2=1028862&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java (original) +++ tomcat/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java Fri Oct 29 17:47:01 2010 @@ -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"); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org