craigmcc 01/08/20 15:43:52
Modified: catalina/src/share/org/apache/catalina/servlets
InvokerServlet.java
webapps/tomcat-docs index.xml project.xml
Log:
Synchronize around the first-time creation of a new Wrapper for the
invoked servlet. This avoids race conditions when multiple requests try
to create the same wrapper at the same time.
PR: Bugzilla #3188
Submitted by: Eddie Ruvinsky <[EMAIL PROTECTED]>
Revision Changes Path
1.11 +29 -23
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/InvokerServlet.java
Index: InvokerServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/InvokerServlet.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- InvokerServlet.java 2001/08/20 00:33:34 1.10
+++ InvokerServlet.java 2001/08/20 22:43:52 1.11
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/InvokerServlet.java,v
1.10 2001/08/20 00:33:34 craigmcc Exp $
- * $Revision: 1.10 $
- * $Date: 2001/08/20 00:33:34 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/InvokerServlet.java,v
1.11 2001/08/20 22:43:52 craigmcc Exp $
+ * $Revision: 1.11 $
+ * $Date: 2001/08/20 22:43:52 $
*
* ====================================================================
*
@@ -87,7 +87,7 @@
* in the web application deployment descriptor.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.10 $ $Date: 2001/08/20 00:33:34 $
+ * @version $Revision: 1.11 $ $Date: 2001/08/20 22:43:52 $
*/
public final class InvokerServlet
@@ -342,25 +342,31 @@
log("Creating wrapper for '" + servletClass +
"' with mapping '" + pattern + "'");
- // Create and install a new wrapper
- try {
- wrapper = context.createWrapper();
- wrapper.setName(name);
- wrapper.setLoadOnStartup(1);
- wrapper.setServletClass(servletClass);
- context.addChild(wrapper);
- context.addServletMapping(pattern, name);
- } catch (Throwable t) {
- log(sm.getString("invokerServlet.cannotCreate",
- inRequestURI), t);
- if (included)
- throw new ServletException
- (sm.getString("invokerServlet.cannotCreate",
- inRequestURI), t);
- else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND,
- inRequestURI);
- return;
+ // Create and install a new wrapper (synchronized to avoid
+ // race conditions when multiple requests try to initialize
+ // the same servlet at the same time)
+ synchronized (this) {
+ try {
+ wrapper = context.createWrapper();
+ wrapper.setName(name);
+ wrapper.setLoadOnStartup(1);
+ wrapper.setServletClass(servletClass);
+ context.addChild(wrapper);
+ context.addServletMapping(pattern, name);
+ } catch (Throwable t) {
+ log(sm.getString("invokerServlet.cannotCreate",
+ inRequestURI), t);
+ context.removeServletMapping(pattern);
+ context.removeChild(wrapper);
+ if (included)
+ throw new ServletException
+ (sm.getString("invokerServlet.cannotCreate",
+ inRequestURI), t);
+ else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND,
+ inRequestURI);
+ return;
+ }
}
}
1.8 +4 -0 jakarta-tomcat-4.0/webapps/tomcat-docs/index.xml
Index: index.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/tomcat-docs/index.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- index.xml 2001/08/16 23:21:25 1.7
+++ index.xml 2001/08/20 22:43:52 1.8
@@ -116,6 +116,10 @@
the development of the <em>Jasper</em> JSP container portion of Tomcat
itself, or to better understand its internal architecture and operation.</p>
<ul>
+<!--
+<li><a href="jasper-requirements.html"><strong>Jasper Overall
Requirements</strong></a>
+ - High level Jasper development requirements For Tomcat 4.1.</li>
+-->
<li><a href="jasper/docs/api/index.html"><strong>Javadocs</strong></a>
- Javadoc API documentation for the <em>Jasper</em> JSP container
portion of Tomcat 4.</li>
1.8 +3 -0 jakarta-tomcat-4.0/webapps/tomcat-docs/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/tomcat-docs/project.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- project.xml 2001/08/16 23:21:25 1.7
+++ project.xml 2001/08/20 22:43:52 1.8
@@ -39,6 +39,9 @@
</menu>
<menu name="Jasper Developers">
+<!--
+ <item name="Overall Requirements" href="jasper-requirements.html"/>
+-->
<item name="Javadocs" href="jasper/docs/api/index.html"/>
</menu>