You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/07/02 13:29:46 UTC
svn commit: r1142205 -
/tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java
Author: markt
Date: Sat Jul 2 11:29:46 2011
New Revision: 1142205
URL: http://svn.apache.org/viewvc?rev=1142205&view=rev
Log:
Correct deadlock introduced in r1142112
Modified:
tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java
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=1142205&r1=1142204&r2=1142205&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java Sat Jul 2 11:29:46 2011
@@ -822,13 +822,7 @@ public class StandardWrapper extends Con
log.debug("Allocating non-STM instance");
instance = loadServlet();
- 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 {
+ if (!singleThreadModel) {
// For non-STM, increment here to prevent a race
// condition with unload. Bug 43683, test case
// #3
@@ -850,7 +844,14 @@ public class StandardWrapper extends Con
initServlet(instance);
}
- if (!singleThreadModel) {
+ if (singleThreadModel) {
+ // Have to do this outside of the sync above to prevent a
+ // possible deadlock
+ synchronized (instancePool) {
+ instancePool.push(instance);
+ nInstances++;
+ }
+ } else {
if (log.isTraceEnabled())
log.trace(" Returning non-STM instance");
// For new instances, count will have been incremented at the
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org