Based on my reading of the javadoc and source, I expected 1 "JspRuntimeContext" thread per context when the following conditions were met: 1. development is true and checkInterval is greater than 0 for JspServlet 2. The webapp is a directory
However, I seem to get arbitrary numbers of these threads, usually between 10 and 30, for each context. This is a problem in a hosted environment, where I need every thread I can get. Luckily, I've been able to track down the root cause of all of these extra threads: the <jsp-file> child element of the <servlet> element in web.xml. If the above conditions are met, I'll have one normal JspRuntimeContext + one thread for each servlet that specifies a <jsp-file>. I imagine each of these servlets instantiates a new JspServlet, which instantiates a new JspRuntimeContext in its init method, which calls threadStart()... To reproduce: 1. Install a new Tomcat 5.5.23 2. edit conf/web.xml, and set update the JspServlet to include these params: <init-param> <param-name>development</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>checkInterval</param-name> <param-value>20</param-value> </init-param> 3. Create a "threadTest" dir in webapps/ 4. Create a WEB-INF/web.xml in threadTest/: <?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <servlet> <servlet-name>servletname</servlet-name> <jsp-file>/servletname.jsp</jsp-file> </servlet> <servlet> <servlet-name>servletname2</servlet-name> <jsp-file>/servletname.jsp</jsp-file> </servlet> <servlet> <servlet-name>servletname3</servlet-name> <jsp-file>/servletname.jsp</jsp-file> </servlet> </web-app> 6. Start Tomcat, and observe thread list (you can use ctrl-break). You will see 4 JspRuntimeContexts for the threadTest context: 1 normal one, and one for each servlet that specifies a <jsp-file>. Is this a bug? Hard to say... while I sure don't want one thread for every <jsp-file>, a different instance of JspServlet for each declaration is the "servlet way". Maybe JspRuntimeContext could be a context-wide singleton? Thanks in advance for any further info. Adam On 4/9/07, Mark Thomas <[EMAIL PROTECTED]> wrote:
Adam Rabung wrote: > I _know_ I'll eventually discover this is some configuration problem > on my end, I'm just trying to understand the life-cycle of the > JspRuntimeContext to help me track it down. I'm still stumped. I should have looked at the code rather than relying on my dodgy memory. This looks to be entirely normal to me. The javadoc explains all: http://tomcat.apache.org/tomcat-5.5-doc/jasper/docs/api/org/apache/jasper/compiler/JspRuntimeContext.html Mark --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]