Author: markt
Date: Wed Feb  9 23:13:00 2011
New Revision: 1069166

URL: http://svn.apache.org/viewvc?rev=1069166&view=rev
Log:
Ensure NamingResources follows correct lifecycle

Modified:
    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1069166&r1=1069165&r2=1069166&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Wed Feb  9 
23:13:00 2011
@@ -1944,6 +1944,7 @@ public class StandardContext extends Con
         if (getState() != LifecycleState.NEW) {
             if (oldNamingResources != null) {
                 try {
+                    oldNamingResources.stop();
                     oldNamingResources.destroy();
                 } catch (LifecycleException e) {
                     log.warn("standardContext.namingResource.destroy.fail", e);
@@ -1952,6 +1953,7 @@ public class StandardContext extends Con
             if (namingResources != null) {
                 try {
                     namingResources.init();
+                    namingResources.start();
                 } catch (LifecycleException e) {
                     log.warn("standardContext.namingResource.init.fail", e);
                 }
@@ -4880,6 +4882,12 @@ public class StandardContext extends Con
         setConfigured(false);
         boolean ok = true;
 
+        // Currently this is effectively a NO-OP but needs to be called to
+        // ensure the NamingResources follows the correct lifecycle
+        if (namingResources != null) {
+            namingResources.start();
+        }
+        
         // Add missing components as necessary
         if (webappResources == null) {   // (1) Required by Loader
             if (log.isDebugEnabled())
@@ -5303,6 +5311,12 @@ public class StandardContext extends Con
         
         setState(LifecycleState.STOPPING);
 
+        // Currently this is effectively a NO-OP but needs to be called to
+        // ensure the NamingResources follows the correct lifecycle
+        if (namingResources != null) {
+            namingResources.stop();
+        }
+        
         // Binding thread
         ClassLoader oldCCL = bindThread();
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to