From: markt Date: Wed, 9 Feb 2011 23:13:00 +0000 (+0000) Subject: Ensure NamingResources follows correct lifecycle X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=b6d66a253e7ffb7a4e32800e33cd18db5f068eb0;p=tomcat7.0 Ensure NamingResources follows correct lifecycle git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1069166 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index fb4ec795d..e6598cfdb 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -1944,6 +1944,7 @@ public class StandardContext extends ContainerBase 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 ContainerBase 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 ContainerBase 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 ContainerBase 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();