Author: markt
Date: Fri Jul 1 22:47:46 2011
New Revision: 1142112
URL: http://svn.apache.org/viewvc?rev=1142112&view=rev
Log:
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.
Modified:
tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java
tomcat/trunk/webapps/docs/changelog.xml
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java?rev=1142112&r1=1142111&r2=1142112&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java Fri Jul 1
22:47:46 2011
@@ -822,9 +822,16 @@ public class StandardWrapper extends Con
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();
}
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1142112&r1=1142111&r2=1142112&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Jul 1 22:47:46 2011
@@ -194,6 +194,11 @@
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">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]