Author: remm Date: Thu Mar 16 06:03:12 2006 New Revision: 386331 URL: http://svn.apache.org/viewcvs?rev=386331&view=rev Log: - 38795: Associate more closely bind with a finally unbind. - Based on a patch submitted by Darryl Miles.
Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java?rev=386331&r1=386330&r2=386331&view=diff ============================================================================== --- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java (original) +++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java Thu Mar 16 06:03:12 2006 @@ -4059,18 +4059,19 @@ } } - // Binding thread - ClassLoader oldCCL = bindThread(); - // Standard container startup if (log.isDebugEnabled()) log.debug("Processing standard container startup"); - if (ok) { + // Binding thread + ClassLoader oldCCL = bindThread(); - boolean mainOk = false; - try { + boolean mainOk = false; + try { + + if (ok) { + started = true; // Start our subordinate components, if any @@ -4141,17 +4142,18 @@ mainOk = true; - } finally { - // Unbinding thread - unbindThread(oldCCL); - if (!mainOk) { - // An exception occurred - // Register with JMX anyway, to allow management - registerJMX(); - } } + } finally { + // Unbinding thread + unbindThread(oldCCL); + if (!mainOk) { + // An exception occurred + // Register with JMX anyway, to allow management + registerJMX(); + } } + if (!getConfigured()) { log.error( "Error getConfigured"); ok = false; @@ -4168,38 +4170,42 @@ // Binding thread oldCCL = bindThread(); - // Create context attributes that will be required - if (ok) { - postWelcomeFiles(); - } - - if (ok) { - // Notify our interested LifecycleListeners - lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null); - } - - // Configure and call application event listeners and filters - if (ok) { - if (!listenerStart()) { - log.error( "Error listenerStart"); - ok = false; + try { + + // Create context attributes that will be required + if (ok) { + postWelcomeFiles(); } - } - if (ok) { - if (!filterStart()) { - log.error( "Error filterStart"); - ok = false; + + if (ok) { + // Notify our interested LifecycleListeners + lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null); } + + // Configure and call application event listeners and filters + if (ok) { + if (!listenerStart()) { + log.error( "Error listenerStart"); + ok = false; + } + } + if (ok) { + if (!filterStart()) { + log.error( "Error filterStart"); + ok = false; + } + } + + // Load and initialize all "load on startup" servlets + if (ok) { + loadOnStartup(findChildren()); + } + + } finally { + // Unbinding thread + unbindThread(oldCCL); } - // Load and initialize all "load on startup" servlets - if (ok) { - loadOnStartup(findChildren()); - } - - // Unbinding thread - unbindThread(oldCCL); - // Set available status depending upon startup success if (ok) { if (log.isDebugEnabled()) @@ -4324,30 +4330,30 @@ // Binding thread ClassLoader oldCCL = bindThread(); - // Stop our filters - filterStop(); + try { - // Stop our application listeners - listenerStop(); + // Stop our filters + filterStop(); - // Stop ContainerBackgroundProcessor thread - super.threadStop(); + // Stop our application listeners + listenerStop(); - if ((manager != null) && (manager instanceof Lifecycle)) { - ((Lifecycle) manager).stop(); - } + // Stop ContainerBackgroundProcessor thread + super.threadStop(); - // Finalize our character set mapper - setCharsetMapper(null); + if ((manager != null) && (manager instanceof Lifecycle)) { + ((Lifecycle) manager).stop(); + } - // Normal container shutdown processing - if (log.isDebugEnabled()) - log.debug("Processing standard container shutdown"); - // Notify our interested LifecycleListeners - lifecycle.fireLifecycleEvent(STOP_EVENT, null); - started = false; + // Finalize our character set mapper + setCharsetMapper(null); - try { + // Normal container shutdown processing + if (log.isDebugEnabled()) + log.debug("Processing standard container shutdown"); + // Notify our interested LifecycleListeners + lifecycle.fireLifecycleEvent(STOP_EVENT, null); + started = false; // Stop the Valves in our pipeline (including the basic), if any if (pipeline instanceof Lifecycle) { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]