Only add instance if it has just been created.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 2 Jul 2011 12:01:30 +0000 (12:01 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 2 Jul 2011 12:01:30 +0000 (12:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1142209 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/StandardWrapper.java

index 2d8d15e..2c154d6 100644 (file)
@@ -845,11 +845,13 @@ public class StandardWrapper extends ContainerBase
             }
 
             if (singleThreadModel) {
-                // Have to do this outside of the sync above to prevent a
-                // possible deadlock
-                synchronized (instancePool) {
-                    instancePool.push(instance);
-                    nInstances++;
+                if (newInstance) {
+                    // Have to do this outside of the sync above to prevent a
+                    // possible deadlock
+                    synchronized (instancePool) {
+                        instancePool.push(instance);
+                        nInstances++;
+                    }
                 }
             } else {
                 if (log.isTraceEnabled())