geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1060184 - /geronimo/external/trunk/tomcat-parent-7.0.6/catalina/src/main/java/org/apache/catalina/core/StandardContext.java
Date Tue, 18 Jan 2011 04:04:48 GMT
Author: xuhaihong
Date: Tue Jan 18 04:04:48 2011
New Revision: 1060184

URL: http://svn.apache.org/viewvc?rev=1060184&view=rev
Log:
Temporarily remove the changes of starting new thread for the initialization for container, will revert the changes back after we updated the integration codes.

Modified:
    geronimo/external/trunk/tomcat-parent-7.0.6/catalina/src/main/java/org/apache/catalina/core/StandardContext.java

Modified: geronimo/external/trunk/tomcat-parent-7.0.6/catalina/src/main/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.6/catalina/src/main/java/org/apache/catalina/core/StandardContext.java?rev=1060184&r1=1060183&r2=1060184&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.6/catalina/src/main/java/org/apache/catalina/core/StandardContext.java (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.6/catalina/src/main/java/org/apache/catalina/core/StandardContext.java Tue Jan 18 04:04:48 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.Stack;
 import java.util.TreeMap;
-import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicLong;
 
 import javax.management.ListenerNotFoundException;
@@ -119,7 +118,6 @@ import org.apache.tomcat.JarScanner;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.modeler.Registry;
 import org.apache.tomcat.util.scan.StandardJarScanner;
-import org.apache.tomcat.util.threads.DedicatedThreadExecutor;
 
 /**
  * Standard implementation of the <b>Context</b> interface.  Each
@@ -213,33 +211,33 @@ public class StandardContext extends Con
      */
     private boolean antiJARLocking = false;
 
-    
+
     /**
      * The antiResourceLocking flag for this Context.
      */
     private boolean antiResourceLocking = false;
 
-    
+
     /**
      * The set of application listener class names configured for this
      * application, in the order they were encountered in the web.xml file.
      */
     private String applicationListeners[] = new String[0];
-    
+
     private final Object applicationListenersLock = new Object();
 
 
     /**
      * The set of instantiated application event listener objects</code>.
      */
-    private Object applicationEventListenersObjects[] = 
+    private Object applicationEventListenersObjects[] =
         new Object[0];
 
 
     /**
      * The set of instantiated application lifecycle listener objects</code>.
      */
-    private Object applicationLifecycleListenersObjects[] = 
+    private Object applicationLifecycleListenersObjects[] =
         new Object[0];
 
 
@@ -248,8 +246,8 @@ public class StandardContext extends Con
      */
     private Map<ServletContainerInitializer,Set<Class<?>>> initializers =
         new LinkedHashMap<ServletContainerInitializer,Set<Class<?>>>();
-    
-    
+
+
     /**
      * The set of application parameters defined for this application.
      */
@@ -257,13 +255,13 @@ public class StandardContext extends Con
         new ApplicationParameter[0];
 
     private final Object applicationParametersLock = new Object();
-    
+
 
     /**
-     * The broadcaster that sends j2ee notifications. 
+     * The broadcaster that sends j2ee notifications.
      */
     private NotificationBroadcasterSupport broadcaster = null;
-    
+
     /**
      * The Locale to character set mapper for this application.
      */
@@ -293,7 +291,7 @@ public class StandardContext extends Con
      * The security constraints for this web application.
      */
     private SecurityConstraint constraints[] = new SecurityConstraint[0];
-    
+
     private final Object constraintsLock = new Object();
 
 
@@ -321,12 +319,12 @@ public class StandardContext extends Con
      */
     private boolean crossContext = false;
 
-    
+
     /**
      * Encoded path.
      */
     private String encodedPath = null;
-    
+
 
     /**
      * Unencoded path for this web application.
@@ -347,13 +345,13 @@ public class StandardContext extends Con
     private String displayName = null;
 
 
-    /** 
+    /**
      * Override the default context xml location.
      */
     private String defaultContextXml;
 
 
-    /** 
+    /**
      * Override the default web xml location.
      */
     private String defaultWebXml;
@@ -427,7 +425,7 @@ public class StandardContext extends Con
     /**
      * The mapper associated with this context.
      */
-    private org.apache.tomcat.util.http.mapper.Mapper mapper = 
+    private org.apache.tomcat.util.http.mapper.Mapper mapper =
         new org.apache.tomcat.util.http.mapper.Mapper();
 
 
@@ -506,8 +504,8 @@ public class StandardContext extends Con
      * The original document root for this web application.
      */
     private String originalDocBase = null;
-    
-    
+
+
     /**
      * The privileged flag for this web application.
      */
@@ -546,7 +544,7 @@ public class StandardContext extends Con
      */
     private HashMap<String, String> servletMappings =
         new HashMap<String, String>();
-    
+
     private final Object servletMappingsLock = new Object();
 
 
@@ -559,7 +557,7 @@ public class StandardContext extends Con
      * The notification sequence number.
      */
     private AtomicLong sequenceNumber = new AtomicLong(0);
-    
+
     /**
      * The status code error pages for this web application, keyed by
      * HTTP status code (as an Integer).
@@ -690,9 +688,9 @@ public class StandardContext extends Con
     private long startTime;
     private long tldScanTime;
 
-    /** 
+    /**
      * Name of the engine. If null, the domain is used.
-     */ 
+     */
     private String j2EEApplication="none";
     private String j2EEServer="none";
 
@@ -730,37 +728,37 @@ public class StandardContext extends Con
      */
     private boolean saveConfig = true;
 
-    
+
     /**
      * The name to use for session cookies. <code>null</code> indicates that
      * the name is controlled by the application.
      */
     private String sessionCookieName;
-    
-    
+
+
     /**
      * The flag that indicates that session cookies should use HttpOnly
      */
     private boolean useHttpOnly = true;
 
-    
+
     /**
      * The domain to use for session cookies. <code>null</code> indicates that
      * the domain is controlled by the application.
      */
     private String sessionCookieDomain;
-    
-    
+
+
     /**
      * The path to use for session cookies. <code>null</code> indicates that
      * the path is controlled by the application.
      */
     private String sessionCookiePath;
-    
-    
+
+
     /**
      * The Jar scanner to use to search for Jars that might contain
-     * configuration information such as TLDs or web-fragment.xml files. 
+     * configuration information such as TLDs or web-fragment.xml files.
      */
     private JarScanner jarScanner = null;
 
@@ -771,10 +769,10 @@ public class StandardContext extends Con
      * some issues reported with log4j when this option is true. Applications
      * without memory leaks using recent JVMs should operate correctly with this
      * option set to <code>false</code>. If not specified, the default value of
-     * <code>false</code> will be used. 
+     * <code>false</code> will be used.
      */
     private boolean clearReferencesStatic = false;
-    
+
     /**
      * Should Tomcat attempt to terminate threads that have been started by the
      * web application? Stopping threads is performed via the deprecated (for
@@ -800,14 +798,14 @@ public class StandardContext extends Con
      * StandardThreadExecutor of ThreadPoolExecutor be set to a positive value.
      */
     private boolean renewThreadsWhenStoppingContext = true;
-    
+
     /**
      * Should the effective web.xml be logged when the context starts?
      */
     private boolean logEffectiveWebXml = false;
 
     private int effectiveMajorVersion = 3;
-    
+
     private int effectiveMinorVersion = 0;
 
     private JspConfigDescriptor jspConfigDescriptor =
@@ -896,12 +894,12 @@ public class StandardContext extends Con
     public void setEffectiveMinorVersion(int effectiveMinorVersion) {
         this.effectiveMinorVersion = effectiveMinorVersion;
     }
-    
+
     @Override
     public void setLogEffectiveWebXml(boolean logEffectiveWebXml) {
         this.logEffectiveWebXml = logEffectiveWebXml;
     }
-    
+
     @Override
     public boolean getLogEffectiveWebXml() {
         return logEffectiveWebXml;
@@ -911,7 +909,7 @@ public class StandardContext extends Con
     public Authenticator getAuthenticator() {
         if (this instanceof Authenticator)
             return (Authenticator) this;
-        
+
         Pipeline pipeline = getPipeline();
         if (pipeline != null) {
             Valve basic = pipeline.getBasic();
@@ -925,7 +923,7 @@ public class StandardContext extends Con
         }
         return null;
     }
-    
+
     @Override
     public JarScanner getJarScanner() {
         if (jarScanner == null) {
@@ -940,7 +938,7 @@ public class StandardContext extends Con
         this.jarScanner = jarScanner;
     }
 
-     
+
     public InstanceManager getInstanceManager() {
        return instanceManager;
     }
@@ -950,7 +948,7 @@ public class StandardContext extends Con
        this.instanceManager = instanceManager;
     }
 
-    
+
     @Override
     public String getEncodedPath() {
         return encodedPath;
@@ -1038,7 +1036,7 @@ public class StandardContext extends Con
 
 
     /**
-     * Return the list of resource aliases. 
+     * Return the list of resource aliases.
      */
     public String getAliases() {
         return this.aliases;
@@ -1059,8 +1057,8 @@ public class StandardContext extends Con
                     getName()));
         }
     }
-    
-    
+
+
     /**
      * Set the current alias configuration. The list of aliases should be of the
      * form "/aliasPath1=docBase1,/aliasPath2=docBase2" where aliasPathN must
@@ -1070,11 +1068,11 @@ public class StandardContext extends Con
     public void setAliases(String aliases) {
         this.aliases = aliases;
     }
-    
-    
+
+
     /**
      * Add a ServletContainerInitializer instance to this web application.
-     * 
+     *
      * @param sci       The instance to add
      * @param classes   The classes in which the initializer expressed an
      *                  interest
@@ -1085,7 +1083,7 @@ public class StandardContext extends Con
         initializers.put(sci, classes);
     }
 
-    
+
     /**
      * Return the "follow standard delegation model" flag used to configure
      * our ClassLoader.
@@ -1180,8 +1178,8 @@ public class StandardContext extends Con
         newListeners[len] = listener;
         applicationEventListenersObjects = newListeners;
     }
-    
-    
+
+
     /**
      * Return the set of initialized application lifecycle listener objects,
      * in the order they were specified in the web application deployment
@@ -1221,7 +1219,7 @@ public class StandardContext extends Con
         applicationLifecycleListenersObjects = newListeners;
     }
 
-    
+
     /**
      * Return the antiJARLocking flag for this Context.
      */
@@ -1404,12 +1402,12 @@ public class StandardContext extends Con
                                    this.cookies);
 
     }
-    
-    
+
+
     /**
      * Gets the name to use for session cookies. Overrides any setting that
      * may be specified by the application.
-     * 
+     *
      * @return  The value of the default session cookie name or null if not
      *          specified
      */
@@ -1417,12 +1415,12 @@ public class StandardContext extends Con
     public String getSessionCookieName() {
         return sessionCookieName;
     }
-    
-    
+
+
     /**
      * Sets the name to use for session cookies. Overrides any setting that
      * may be specified by the application.
-     * 
+     *
      * @param sessionCookieName   The name to use
      */
     @Override
@@ -1433,10 +1431,10 @@ public class StandardContext extends Con
                 oldSessionCookieName, sessionCookieName);
     }
 
-    
+
     /**
      * Gets the value of the use HttpOnly cookies for session cookies flag.
-     * 
+     *
      * @return <code>true</code> if the HttpOnly flag should be set on session
      *         cookies
      */
@@ -1448,7 +1446,7 @@ public class StandardContext extends Con
 
     /**
      * Sets the use HttpOnly cookies for session cookies flag.
-     * 
+     *
      * @param useHttpOnly   Set to <code>true</code> to use HttpOnly cookies
      *                          for session cookies
      */
@@ -1460,12 +1458,12 @@ public class StandardContext extends Con
                 oldUseHttpOnly,
                 this.useHttpOnly);
     }
-    
-    
+
+
     /**
      * Gets the domain to use for session cookies. Overrides any setting that
      * may be specified by the application.
-     * 
+     *
      * @return  The value of the default session cookie domain or null if not
      *          specified
      */
@@ -1473,12 +1471,12 @@ public class StandardContext extends Con
     public String getSessionCookieDomain() {
         return sessionCookieDomain;
     }
-    
-    
+
+
     /**
      * Sets the domain to use for session cookies. Overrides any setting that
      * may be specified by the application.
-     * 
+     *
      * @param sessionCookieDomain   The domain to use
      */
     @Override
@@ -1488,12 +1486,12 @@ public class StandardContext extends Con
         support.firePropertyChange("sessionCookieDomain",
                 oldSessionCookieDomain, sessionCookieDomain);
     }
-    
+
 
     /**
      * Gets the path to use for session cookies. Overrides any setting that
      * may be specified by the application.
-     * 
+     *
      * @return  The value of the default session cookie path or null if not
      *          specified
      */
@@ -1501,12 +1499,12 @@ public class StandardContext extends Con
     public String getSessionCookiePath() {
         return sessionCookiePath;
     }
-    
-    
+
+
     /**
      * Sets the path to use for session cookies. Overrides any setting that
      * may be specified by the application.
-     * 
+     *
      * @param sessionCookiePath   The path to use
      */
     @Override
@@ -1516,7 +1514,7 @@ public class StandardContext extends Con
         support.firePropertyChange("sessionCookiePath",
                 oldSessionCookiePath, sessionCookiePath);
     }
-    
+
 
     /**
      * Return the "allow crossing servlet contexts" flag.
@@ -1549,12 +1547,12 @@ public class StandardContext extends Con
         return defaultContextXml;
     }
 
-    /** 
+    /**
      * Set the location of the default context xml that will be used.
      * If not absolute, it'll be made relative to the engine's base dir
      * ( which defaults to catalina.base system property ).
      *
-     * @param defaultContextXml The default web xml 
+     * @param defaultContextXml The default web xml
      */
     public void setDefaultContextXml(String defaultContextXml) {
         this.defaultContextXml = defaultContextXml;
@@ -1564,12 +1562,12 @@ public class StandardContext extends Con
         return defaultWebXml;
     }
 
-    /** 
+    /**
      * Set the location of the default web xml that will be used.
      * If not absolute, it'll be made relative to the engine's base dir
      * ( which defaults to catalina.base system property ).
      *
-     * @param defaultWebXml The default web xml 
+     * @param defaultWebXml The default web xml
      */
     public void setDefaultWebXml(String defaultWebXml) {
         this.defaultWebXml = defaultWebXml;
@@ -1767,12 +1765,12 @@ public class StandardContext extends Con
     public boolean getIgnoreAnnotations() {
         return this.ignoreAnnotations;
     }
-    
-    
+
+
     /**
-     * Set the boolean on the annotations parsing for this web 
+     * Set the boolean on the annotations parsing for this web
      * application.
-     * 
+     *
      * @param ignoreAnnotations The boolean on the annotations parsing
      */
     @Override
@@ -1782,8 +1780,8 @@ public class StandardContext extends Con
         support.firePropertyChange("ignoreAnnotations", oldIgnoreAnnotations,
                 this.ignoreAnnotations);
     }
-    
-    
+
+
     /**
      * Return the login configuration descriptor for this web application.
      */
@@ -1880,9 +1878,9 @@ public class StandardContext extends Con
         namingResources.setContainer(this);
         support.firePropertyChange("namingResources",
                                    oldNamingResources, this.namingResources);
-        
+
         // If set from server.xml, getObjectKeyPropertiesNameOnly() will
-        // trigger an NPE. Initial registration takes place on INIT. 
+        // trigger an NPE. Initial registration takes place on INIT.
         if (getState() != LifecycleState.NEW) {
             unregister(onameNamingResources);
             onameNamingResources = register(namingResources,
@@ -1902,7 +1900,7 @@ public class StandardContext extends Con
 
     /**
      * Set the context path for this Context.
-     * 
+     *
      * @param path The new context path
      */
     @Override
@@ -1990,7 +1988,7 @@ public class StandardContext extends Con
 
         this.originalDocBase = docBase;
     }
-    
+
 
     /**
      * Return the parent class loader (if any) for this web application.
@@ -2009,7 +2007,7 @@ public class StandardContext extends Con
         return (ClassLoader.getSystemClassLoader());
     }
 
-    
+
     /**
      * Return the privileged flag for this web application.
      */
@@ -2192,7 +2190,7 @@ public class StandardContext extends Con
     /**
      * Set the value of the unloadDelay flag, which represents the amount
      * of ms that the container will wait when unloading servlets.
-     * Setting this to a small value may cause more requests to fail 
+     * Setting this to a small value may cause more requests to fail
      * to complete when stopping a web application.
      *
      * @param unloadDelay The new value
@@ -2254,7 +2252,7 @@ public class StandardContext extends Con
         this.wrapperClassName = wrapperClassName;
 
         try {
-            wrapperClass = Class.forName(wrapperClassName);         
+            wrapperClass = Class.forName(wrapperClassName);
             if (!StandardWrapper.class.isAssignableFrom(wrapperClass)) {
                 throw new IllegalArgumentException(
                     sm.getString("standardContext.invalidWrapperClass",
@@ -2308,7 +2306,7 @@ public class StandardContext extends Con
 
     }
 
-    
+
     @Override
     public JspConfigDescriptor getJspConfigDescriptor() {
         return jspConfigDescriptor;
@@ -2346,9 +2344,9 @@ public class StandardContext extends Con
 
     /** Get the absolute path to the work dir.
      *  To avoid duplication.
-     * 
+     *
      * @return The work path
-     */ 
+     */
     public String getWorkPath() {
         if (getWorkDir() == null) {
             return null;
@@ -2368,7 +2366,7 @@ public class StandardContext extends Con
         }
         return workDir.getAbsolutePath();
     }
-    
+
     /**
      * Return the work directory for this Context.
      */
@@ -2721,7 +2719,7 @@ public class StandardContext extends Con
         fireContainerEvent("addFilterMap", filterMap);
     }
 
-    
+
     /**
      * Add a filter mapping to this Context before the mappings defined in the
      * deployment descriptor but after any other mappings added via this method.
@@ -2753,8 +2751,8 @@ public class StandardContext extends Con
             throw new IllegalArgumentException
                 (sm.getString("standardContext.filterMap.name", filterName));
 
-        if (!filterMap.getMatchAllServletNames() && 
-            !filterMap.getMatchAllUrlPatterns() && 
+        if (!filterMap.getMatchAllServletNames() &&
+            !filterMap.getMatchAllUrlPatterns() &&
             (servletNames.length == 0) && (urlPatterns.length == 0))
             throw new IllegalArgumentException
                 (sm.getString("standardContext.filterMap.either"));
@@ -3297,8 +3295,8 @@ public class StandardContext extends Con
     public Context findMappingObject() {
         return (Context) getMappingObject();
     }
-    
-    
+
+
     /**
      * Return the message destination with the specified name, if any;
      * otherwise, return <code>null</code>.
@@ -3566,7 +3564,7 @@ public class StandardContext extends Con
 
 
     /**
-     * Return the set of watched resources for this Context. If none are 
+     * Return the set of watched resources for this Context. If none are
      * defined, a zero length array will be returned.
      */
     @Override
@@ -3575,8 +3573,8 @@ public class StandardContext extends Con
             return watchedResources;
         }
     }
-    
-    
+
+
     /**
      * Return the set of welcome files defined for this Context.  If none are
      * defined, a zero-length array is returned.
@@ -4049,12 +4047,12 @@ public class StandardContext extends Con
     /**
      * Remove the specified watched resource name from the list associated
      * with this Context.
-     * 
+     *
      * @param name Name of the watched resource to be removed
      */
     @Override
     public void removeWatchedResource(String name) {
-        
+
         synchronized (watchedResourcesLock) {
 
             // Make sure this watched resource is currently present
@@ -4082,8 +4080,8 @@ public class StandardContext extends Con
         fireContainerEvent("removeWatchedResource", name);
 
     }
-    
-    
+
+
     /**
      * Remove the specified welcome file name from the list recognized
      * by this Context.
@@ -4212,7 +4210,7 @@ public class StandardContext extends Con
      * StandardContext
      */
     public long getProcessingTime() {
-        
+
         long result = 0;
 
         Container[] children = findChildren();
@@ -4294,7 +4292,7 @@ public class StandardContext extends Con
         /**
          * Add a filter mapping at the end of the current set of filter
          * mappings.
-         * 
+         *
          * @param filterMap
          *            The filter mapping to be added
          */
@@ -4309,7 +4307,7 @@ public class StandardContext extends Con
         /**
          * Add a filter mapping before the mappings defined in the deployment
          * descriptor but after any other mappings added via this method.
-         * 
+         *
          * @param filterMap
          *            The filter mapping to be added
          */
@@ -4503,7 +4501,7 @@ public class StandardContext extends Con
         // Ensure context is not null
         getServletContext();
         context.setNewServletContextListenerAllowed(false);
-        
+
         Object instances[] = getApplicationLifecycleListeners();
         if (instances == null)
             return (ok);
@@ -4599,7 +4597,7 @@ public class StandardContext extends Con
                 }
             }
         }
-        
+
         setApplicationEventListeners(null);
         setApplicationLifecycleListeners(null);
 
@@ -4647,8 +4645,8 @@ public class StandardContext extends Con
                 if (!contextName.startsWith("/")) {
                     contextName = "/" + contextName;
                 }
-                ObjectName resourcesName = 
-                    new ObjectName(this.getDomain() + ":type=Cache,host=" 
+                ObjectName resourcesName =
+                    new ObjectName(this.getDomain() + ":type=Cache,host="
                                    + getHostname() + ",context=" + contextName);
                 Registry.getRegistry(null, null).registerComponent
                     (proxyDirContext.getCache(), resourcesName, null);
@@ -4686,10 +4684,10 @@ public class StandardContext extends Con
                     if (!contextName.startsWith("/")) {
                         contextName = "/" + contextName;
                     }
-                    ObjectName resourcesName = 
+                    ObjectName resourcesName =
                         new ObjectName(this.getDomain()
-                                       + ":type=Cache,host=" 
-                                       + getHostname() + ",context=" 
+                                       + ":type=Cache,host="
+                                       + getHostname() + ",context="
                                        + contextName);
                     Registry.getRegistry(null, null)
                         .unregisterComponent(resourcesName);
@@ -4765,7 +4763,7 @@ public class StandardContext extends Con
         if(log.isDebugEnabled())
             log.debug("Starting " + getBaseName());
 
-        // Send j2ee.state.starting notification 
+        // Send j2ee.state.starting notification
         if (this.getObjectName() != null) {
             Notification notification = new Notification("j2ee.state.starting",
                     this.getObjectName(), sequenceNumber.getAndIncrement());
@@ -4839,19 +4837,19 @@ public class StandardContext extends Con
                 setNamingContextListener(ncl);
             }
         }
-        
+
         // Standard container startup
         if (log.isDebugEnabled())
             log.debug("Processing standard container startup");
 
-        
+
         // Binding thread
         ClassLoader oldCCL = bindThread();
 
         try {
 
             if (ok) {
-                
+
                 // Start our subordinate components, if any
                 if ((loader != null) && (loader instanceof Lifecycle))
                     ((Lifecycle) loader).start();
@@ -4863,13 +4861,13 @@ public class StandardContext extends Con
                 unbindThread(oldCCL);
                 oldCCL = bindThread();
 
-                // Initialize logger again. Other components might have used it too early, 
+                // Initialize logger again. Other components might have used it too early,
                 // so it should be reset.
                 logger = null;
                 getLogger();
                 if ((logger != null) && (logger instanceof Lifecycle))
                     ((Lifecycle) logger).start();
-                
+
                 if ((cluster != null) && (cluster instanceof Lifecycle))
                     ((Lifecycle) cluster).start();
                 if ((realm != null) && (realm instanceof Lifecycle))
@@ -4879,7 +4877,7 @@ public class StandardContext extends Con
 
                 // Notify our interested LifecycleListeners
                 fireLifecycleEvent(Lifecycle.CONFIGURE_START_EVENT, null);
-                
+
                 // Start our child containers, if not already started
                 for (Container child : findChildren()) {
                     if (!child.getState().isAvailable()) {
@@ -4892,7 +4890,7 @@ public class StandardContext extends Con
                 if (pipeline instanceof Lifecycle) {
                     ((Lifecycle) pipeline).start();
                 }
-                
+
                 // Acquire clustered manager
                 Manager contextManager = null;
                 if (manager == null) {
@@ -4911,8 +4909,8 @@ public class StandardContext extends Con
                     } else {
                         contextManager = new StandardManager();
                     }
-                } 
-                
+                }
+
                 // Configure default manager if none was specified
                 if (contextManager != null) {
                     if (log.isDebugEnabled()) {
@@ -4965,9 +4963,9 @@ public class StandardContext extends Con
             }
         }
 
-        DedicatedThreadExecutor temporaryExecutor = new DedicatedThreadExecutor();
+        //DedicatedThreadExecutor temporaryExecutor = new DedicatedThreadExecutor();
         try {
-            
+
             // Create context attributes that will be required
             if (ok) {
                 getServletContext().setAttribute(
@@ -4992,6 +4990,7 @@ public class StandardContext extends Con
 
             // Configure and call application event listeners
             if (ok) {
+                if(!listenerStart()) {/*
                 // we do it in a dedicated thread for memory leak protection, in
                 // case the Listeners registers some ThreadLocals that they
                 // forget to cleanup
@@ -5007,18 +5006,18 @@ public class StandardContext extends Con
                             }
                         }
                     });
-                if (!listenerStarted.booleanValue()) {
+                if (!listenerStarted.booleanValue()) {*/
                     log.error( "Error listenerStart");
                     ok = false;
                 }
             }
-            
+
             try {
                 // Start manager
                 if ((manager != null) && (manager instanceof Lifecycle)) {
                     ((Lifecycle) getManager()).start();
                 }
-    
+
                 // Start ContainerBackgroundProcessor thread
                 super.threadStart();
             } catch(Exception e) {
@@ -5028,7 +5027,8 @@ public class StandardContext extends Con
 
             // Configure and call application filters
             if (ok) {
-                // we do it in a dedicated thread for memory leak protection, in
+                if(!filterStart()) {
+                /*// we do it in a dedicated thread for memory leak protection, in
                 // case the Filters register some ThreadLocals that they forget
                 // to cleanup
                 Boolean filterStarted =
@@ -5043,14 +5043,15 @@ public class StandardContext extends Con
                             }
                         }
                     });
-                if (!filterStarted.booleanValue()) {
+                if (!filterStarted.booleanValue()) {*/
                     log.error("Error filterStart");
                     ok = false;
                 }
             }
-            
+
             // Load and initialize all "load on startup" servlets
             if (ok) {
+                loadOnStartup(findChildren());/*
                 // we do it in a dedicated thread for memory leak protection, in
                 // case the Servlets register some ThreadLocals that they forget
                 // to cleanup
@@ -5065,13 +5066,13 @@ public class StandardContext extends Con
                             unbindThread(old);
                         }
                     }
-                });
+                });*/
             }
-            
+
         } finally {
             // Unbinding thread
             unbindThread(oldCCL);
-            temporaryExecutor.shutdown();
+            //temporaryExecutor.shutdown();
         }
 
         // Set available status depending upon startup success
@@ -5083,16 +5084,16 @@ public class StandardContext extends Con
         }
 
         startTime=System.currentTimeMillis();
-        
-        // Send j2ee.state.running notification 
+
+        // Send j2ee.state.running notification
         if (ok && (this.getObjectName() != null)) {
-            Notification notification = 
+            Notification notification =
                 new Notification("j2ee.state.running", this.getObjectName(),
                                  sequenceNumber.getAndIncrement());
             broadcaster.sendNotification(notification);
         }
 
-        // Close all JARs right away to avoid always opening a peak number 
+        // Close all JARs right away to avoid always opening a peak number
         // of files on startup
         if (getLoader() instanceof WebappLoader) {
             ((WebappLoader) getLoader()).closeJARs(true);
@@ -5148,7 +5149,7 @@ public class StandardContext extends Con
         }
     }
 
-    
+
 
     /**
      * Merge the context initialization parameters specified in the application
@@ -5158,7 +5159,7 @@ public class StandardContext extends Con
      */
     private void mergeParameters() {
         ServletContext sc = getServletContext();
-        
+
         String names[] = findParameters();
         for (int i = 0; i < names.length; i++) {
             sc.setInitParameter(names[i], findParameter(names[i]));
@@ -5188,14 +5189,14 @@ public class StandardContext extends Con
     @Override
     protected synchronized void stopInternal() throws LifecycleException {
 
-        // Send j2ee.state.stopping notification 
+        // Send j2ee.state.stopping notification
         if (this.getObjectName() != null) {
-            Notification notification = 
-                new Notification("j2ee.state.stopping", this.getObjectName(), 
+            Notification notification =
+                new Notification("j2ee.state.stopping", this.getObjectName(),
                                  sequenceNumber.getAndIncrement());
             broadcaster.sendNotification(notification);
         }
-        
+
         setState(LifecycleState.STOPPING);
 
         // Binding thread
@@ -5205,7 +5206,24 @@ public class StandardContext extends Con
 
             // Stop our child containers, if any
             final Container[] children = findChildren();
-            // we do it in a dedicated thread for memory leak protection, in
+            for (int i = 0; i < children.length; i++) {
+                children[i].stop();
+            }
+
+            // Stop our filters
+            filterStop();
+
+            // Stop ContainerBackgroundProcessor thread
+            threadStop();
+
+            if ((manager != null) &&
+                    (manager instanceof Lifecycle)) {
+                ((Lifecycle) manager).stop();
+            }
+
+            // Stop our application listeners
+            listenerStop();
+            /*// we do it in a dedicated thread for memory leak protection, in
             // case some webapp code registers some ThreadLocals that they
             // forget to cleanup
             DedicatedThreadExecutor.executeInOwnThread(
@@ -5217,18 +5235,18 @@ public class StandardContext extends Con
                         for (int i = 0; i < children.length; i++) {
                             children[i].stop();
                         }
-            
+
                         // Stop our filters
                         filterStop();
-            
+
                         // Stop ContainerBackgroundProcessor thread
                         threadStop();
-            
-                        if ((manager != null) && 
+
+                        if ((manager != null) &&
                                 (manager instanceof Lifecycle)) {
                             ((Lifecycle) manager).stop();
                         }
-            
+
                         // Stop our application listeners
                         listenerStop();
                         return null;
@@ -5236,7 +5254,7 @@ public class StandardContext extends Con
                         unbindThread(old);
                     }
                 }
-            });
+            });*/
 
             // Finalize our character set mapper
             setCharsetMapper(null);
@@ -5279,24 +5297,24 @@ public class StandardContext extends Con
 
         }
 
-        // Send j2ee.state.stopped notification 
+        // Send j2ee.state.stopped notification
         if (this.getObjectName() != null) {
-            Notification notification = 
-                new Notification("j2ee.state.stopped", this.getObjectName(), 
+            Notification notification =
+                new Notification("j2ee.state.stopped", this.getObjectName(),
                                 sequenceNumber.getAndIncrement());
             broadcaster.sendNotification(notification);
         }
-        
+
         // Reset application context
         context = null;
 
-        // This object will no longer be visible or used. 
+        // This object will no longer be visible or used.
         try {
             resetContext();
         } catch( Exception ex ) {
             log.error( "Error reseting context " + this + " " + ex, ex );
         }
-        
+
         //reset the instance manager
         instanceManager = null;
 
@@ -5306,20 +5324,20 @@ public class StandardContext extends Con
     }
 
     /** Destroy needs to clean up the context completely.
-     * 
-     * The problem is that undoing all the config in start() and restoring 
+     *
+     * The problem is that undoing all the config in start() and restoring
      * a 'fresh' state is impossible. After stop()/destroy()/init()/start()
      * we should have the same state as if a fresh start was done - i.e
-     * read modified web.xml, etc. This can only be done by completely 
+     * read modified web.xml, etc. This can only be done by completely
      * removing the context object and remapping a new one, or by cleaning
      * up everything.
-     * 
+     *
      * XXX Should this be done in stop() ?
-     * 
-     */ 
+     *
+     */
     @Override
     protected void destroyInternal() throws LifecycleException {
-        
+
         if ((manager != null) && (manager instanceof Lifecycle)) {
             ((Lifecycle) manager).destroy();
         }
@@ -5336,9 +5354,9 @@ public class StandardContext extends Con
             ((Lifecycle) loader).destroy();
         }
 
-        // Send j2ee.object.deleted notification 
-        Notification notification = 
-            new Notification("j2ee.object.deleted", this.getObjectName(), 
+        // Send j2ee.object.deleted notification
+        Notification notification =
+            new Notification("j2ee.object.deleted", this.getObjectName(),
                              sequenceNumber.getAndIncrement());
         broadcaster.sendNotification(notification);
 
@@ -5350,11 +5368,11 @@ public class StandardContext extends Con
 
         super.destroyInternal();
     }
-    
+
     private void resetContext() throws Exception {
         // Restore the original state ( pre reading web.xml in start )
         // If you extend this - override this method and make sure to clean up
-        
+
         // Don't reset anything that is read from a <Context.../> element since
         // <Context .../> elements are read at initialisation will not be read
         // again for this object
@@ -5370,9 +5388,9 @@ public class StandardContext extends Con
         applicationEventListenersObjects = new Object[0];
         applicationLifecycleListenersObjects = new Object[0];
         jspConfigDescriptor = new ApplicationJspConfigDescriptor();
-        
+
         initializers.clear();
-        
+
         if(log.isDebugEnabled())
             log.debug("resetContext " + getObjectName());
     }
@@ -5542,7 +5560,8 @@ public class StandardContext extends Con
                 (getLoader().getClassLoader());
         }
 
-        DirContextURLStreamHandler.bindThread(getResources());
+        //DirContextURLStreamHandler.bindThread(getResources());
+        DirContextURLStreamHandler.bind(getResources());
 
         if (isUseNaming()) {
             try {
@@ -5563,13 +5582,18 @@ public class StandardContext extends Con
      */
     private void unbindThread(ClassLoader oldContextClassLoader) {
 
+        Thread.currentThread().setContextClassLoader(oldContextClassLoader);
+
+        oldContextClassLoader = null;
+
         if (isUseNaming()) {
             ContextBindings.unbindThread(this, this);
         }
 
-        DirContextURLStreamHandler.unbindThread();
+        DirContextURLStreamHandler.unbind();
+        //DirContextURLStreamHandler.unbindThread();
 
-        Thread.currentThread().setContextClassLoader(oldContextClassLoader);
+        //Thread.currentThread().setContextClassLoader(oldContextClassLoader);
     }
 
 
@@ -5647,14 +5671,14 @@ public class StandardContext extends Con
     return namingContextName;
     }
 
-    
+
     /**
      * Naming context listener accessor.
      */
     public NamingContextListener getNamingContextListener() {
         return namingContextListener;
     }
-    
+
 
     /**
      * Naming context listener setter.
@@ -5662,7 +5686,7 @@ public class StandardContext extends Con
     public void setNamingContextListener(NamingContextListener namingContextListener) {
         this.namingContextListener = namingContextListener;
     }
-    
+
 
     /**
      * Return the request processing paused flag for this Context.
@@ -5693,7 +5717,7 @@ public class StandardContext extends Con
 
         if ((instances != null) && (instances.length > 0)) {
 
-            ServletRequestEvent event = 
+            ServletRequestEvent event =
                     new ServletRequestEvent(getServletContext(), request);
 
             for (int i = 0; i < instances.length; i++) {
@@ -5703,7 +5727,7 @@ public class StandardContext extends Con
                     continue;
                 ServletRequestListener listener =
                     (ServletRequestListener) instances[i];
-                
+
                 try {
                     // Don't fire the listener for async requests
                     if (!DispatcherType.ASYNC.equals(
@@ -5730,7 +5754,7 @@ public class StandardContext extends Con
 
         if ((instances != null) && (instances.length > 0)) {
 
-            ServletRequestEvent event = 
+            ServletRequestEvent event =
                     new ServletRequestEvent(getServletContext(), request);
 
             for (int i = 0; i < instances.length; i++) {
@@ -5741,7 +5765,7 @@ public class StandardContext extends Con
                     continue;
                 ServletRequestListener listener =
                     (ServletRequestListener) instances[j];
-                
+
                 try {
                     // Don't fire the listener for async requests
                     if (!DispatcherType.ASYNC.equals(
@@ -5898,10 +5922,10 @@ public class StandardContext extends Con
     /**
      * JSR77 deploymentDescriptor attribute
      *
-     * @return string deployment descriptor 
+     * @return string deployment descriptor
      */
     public String getDeploymentDescriptor() {
-    
+
         InputStream stream = null;
         ServletContext servletContext = getServletContext();
         if (servletContext != null) {
@@ -5930,17 +5954,17 @@ public class StandardContext extends Con
             }
         }
 
-        return sb.toString(); 
+        return sb.toString();
     }
-    
-    
+
+
     /**
      * JSR77 servlets attribute
      *
      * @return list of all servlets ( we know about )
      */
     public String[] getServlets() {
-        
+
         String[] result = null;
 
         Container[] children = findChildren();
@@ -5953,7 +5977,7 @@ public class StandardContext extends Con
 
         return result;
     }
-    
+
 
     @Override
     protected String getObjectNameKeyProperties() {
@@ -5968,7 +5992,7 @@ public class StandardContext extends Con
 
         return keyProperties.toString();
     }
-    
+
     private String getObjectKeyPropertiesNameOnly() {
         StringBuilder result = new StringBuilder("name=//");
         String hostname = getParent().getName();
@@ -5977,7 +6001,7 @@ public class StandardContext extends Con
         } else {
             result.append(hostname);
         }
-        
+
         String contextName = getName();
         if (!contextName.startsWith("/")) {
             result.append('/');
@@ -5990,7 +6014,7 @@ public class StandardContext extends Con
     @Override
     protected void initInternal() throws LifecycleException {
         super.initInternal();
-        
+
         if (processTlds) {
             this.addLifecycleListener(new TldConfig());
         }
@@ -6001,7 +6025,7 @@ public class StandardContext extends Con
                     "type=NamingResources," + getObjectNameKeyProperties());
         }
 
-        // Send j2ee.object.created notification 
+        // Send j2ee.object.created notification
         if (this.getObjectName() != null) {
             Notification notification = new Notification("j2ee.object.created",
                     this.getObjectName(), sequenceNumber.getAndIncrement());
@@ -6010,17 +6034,17 @@ public class StandardContext extends Con
     }
 
 
-    /* Remove a JMX notficationListener 
+    /* Remove a JMX notficationListener
      * @see javax.management.NotificationEmitter#removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
      */
     @Override
-    public void removeNotificationListener(NotificationListener listener, 
+    public void removeNotificationListener(NotificationListener listener,
             NotificationFilter filter, Object object) throws ListenerNotFoundException {
         broadcaster.removeNotificationListener(listener,filter,object);
     }
-    
+
     private MBeanNotificationInfo[] notificationInfo;
-    
+
     /* Get JMX Broadcaster Info
      * @TODO use StringManager for international support!
      * @TODO This two events we not send j2ee.state.failed and j2ee.attribute.changed!
@@ -6035,7 +6059,7 @@ public class StandardContext extends Con
                     "j2ee.object.created"},
                     Notification.class.getName(),
                     "web application is created"
-                    ), 
+                    ),
                     new MBeanNotificationInfo(new String[] {
                     "j2ee.state.starting"},
                     Notification.class.getName(),
@@ -6062,34 +6086,34 @@ public class StandardContext extends Con
                     "web application is deleted"
                     )
             };
-            
+
         }
-        
+
         return notificationInfo;
     }
-    
-    
+
+
     /* Add a JMX-NotificationListener
      * @see javax.management.NotificationBroadcaster#addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
      */
     @Override
-    public void addNotificationListener(NotificationListener listener, 
+    public void addNotificationListener(NotificationListener listener,
             NotificationFilter filter, Object object) throws IllegalArgumentException {
         broadcaster.addNotificationListener(listener,filter,object);
     }
-    
-    
+
+
     /**
-     * Remove a JMX-NotificationListener 
+     * Remove a JMX-NotificationListener
      * @see javax.management.NotificationBroadcaster#removeNotificationListener(javax.management.NotificationListener)
      */
     @Override
-    public void removeNotificationListener(NotificationListener listener) 
+    public void removeNotificationListener(NotificationListener listener)
     throws ListenerNotFoundException {
         broadcaster.removeNotificationListener(listener);
     }
-    
-    
+
+
     // ------------------------------------------------------------- Attributes
 
 
@@ -6105,7 +6129,7 @@ public class StandardContext extends Con
 
     /**
      * Return the naming resources associated with this web application.
-     * FIXME: Fooling introspection ... 
+     * FIXME: Fooling introspection ...
      */
     public javax.naming.directory.DirContext findStaticResources() {
 
@@ -6130,7 +6154,7 @@ public class StandardContext extends Con
      */
     @Override
     public void setXmlValidation(boolean webXmlValidation){
-        
+
         this.webXmlValidation = webXmlValidation;
 
     }
@@ -6164,17 +6188,17 @@ public class StandardContext extends Con
     @Override
     public void setXmlNamespaceAware(boolean webXmlNamespaceAware){
         this.webXmlNamespaceAware= webXmlNamespaceAware;
-    }    
+    }
 
 
     /**
      * Set the validation feature of the XML parser used when
-     * parsing tlds files. 
+     * parsing tlds files.
      * @param tldValidation true to enable xml instance validation
      */
     @Override
     public void setTldValidation(boolean tldValidation){
-        
+
         this.tldValidation = tldValidation;
 
     }
@@ -6223,61 +6247,61 @@ public class StandardContext extends Con
     @Override
     public void setTldNamespaceAware(boolean tldNamespaceAware){
         this.tldNamespaceAware= tldNamespaceAware;
-    }    
+    }
 
 
-    /** 
-     * Support for "stateManageable" JSR77 
+    /**
+     * Support for "stateManageable" JSR77
      */
     public boolean isStateManageable() {
         return true;
     }
-    
+
     public void startRecursive() throws LifecycleException {
         // nothing to start recursive, the servlets will be started by load-on-startup
         start();
     }
-    
+
     /**
      * The J2EE Server ObjectName this module is deployed on.
-     */     
+     */
     private String server = null;
-    
+
     /**
      * The Java virtual machines on which this module is running.
-     */       
+     */
     private String[] javaVMs = null;
-    
+
     public String getServer() {
         return server;
     }
-        
+
     public String setServer(String server) {
         return this.server=server;
     }
-        
+
     public String[] getJavaVMs() {
         return javaVMs;
     }
-        
+
     public String[] setJavaVMs(String[] javaVMs) {
         return this.javaVMs = javaVMs;
     }
-    
+
     /**
      * Gets the time this context was started.
      *
      * @return Time (in milliseconds since January 1, 1970, 00:00:00) when this
-     * context was started 
+     * context was started
      */
     public long getStartTime() {
         return startTime;
     }
-    
+
     public boolean isEventProvider() {
         return false;
     }
-    
+
     public boolean isStatisticsProvider() {
         return false;
     }



Mime
View raw message