When using Servlets that implement the SingleThreadModel interface, add the single...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 1 Jul 2011 22:47:46 +0000 (22:47 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 1 Jul 2011 22:47:46 +0000 (22:47 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1142112 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/StandardWrapper.java
webapps/docs/changelog.xml

index 194e2dd..a2c85aa 100644 (file)
@@ -822,9 +822,16 @@ public class StandardWrapper extends ContainerBase
                                 log.debug("Allocating non-STM instance");
 
                             instance = loadServlet();
-                            // For non-STM, increment here to prevent a race
-                            // condition with unload. Bug 43683, test case #3
-                            if (!singleThreadModel) {
+                            if (singleThreadModel) {
+                                // No need to lock pool since until an instance
+                                // is created, no threads will get past this
+                                // point
+                                instancePool.push(instance);
+                                nInstances++;
+                            } else {
+                                // For non-STM, increment here to prevent a race
+                                // condition with unload. Bug 43683, test case
+                                // #3
                                 newInstance = true;
                                 countAllocated.incrementAndGet();
                             }
index 8e78c08..8c8cdc0 100644 (file)
         In launcher for embedded Tomcat: do not change <code>catalina.home</code>
         system property if it had a value. (kkolinko)
       </fix>
+      <fix>
+        When using Servlets that implement the SingleThreadModel interface, add
+        the single instance created to the pool when it is determined that a
+        pool of servlets is required rather than throwing it away. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">