You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2005/11/17 18:00:30 UTC

svn commit: r345286 - in /tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core: StandardContext.java StandardWrapper.java mbeans-descriptors.xml

Author: remm
Date: Thu Nov 17 09:00:24 2005
New Revision: 345286

URL: http://svn.apache.org/viewcvs?rev=345286&view=rev
Log:
- Allow configuring the amount of time the container will wait when unloading
  servlets.

Modified:
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardWrapper.java
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml

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=345286&r1=345285&r2=345286&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 Nov 17 09:00:24 2005
@@ -513,6 +513,12 @@
 
 
     /**
+     * Amount of ms that the container will wait for servlets to unload.
+     */
+    private long unloadDelay = 2000;
+
+
+    /**
      * The watched resources for this application.
      */
     private String watchedResources[] = new String[0];
@@ -1618,6 +1624,35 @@
         support.firePropertyChange("swallowOutput",
                                    new Boolean(oldSwallowOutput),
                                    new Boolean(this.swallowOutput));
+
+    }
+
+
+    /**
+     * Return the value of the unloadDelay flag.
+     */
+    public long getUnloadDelay() {
+
+        return (this.unloadDelay);
+
+    }
+
+
+    /**
+     * 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 
+     * to complete when stopping a web application.
+     *
+     * @param unloadDelay The new value
+     */
+    public void setUnloadDelay(long unloadDelay) {
+
+        long oldUnloadDelay = this.unloadDelay;
+        this.unloadDelay = unloadDelay;
+        support.firePropertyChange("unloadDelay",
+                                   new Long(oldUnloadDelay),
+                                   new Long(this.unloadDelay));
 
     }
 

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardWrapper.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardWrapper.java?rev=345286&r1=345285&r2=345286&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardWrapper.java (original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardWrapper.java Thu Nov 17 09:00:24 2005
@@ -222,6 +222,12 @@
      */
     private Stack instancePool = null;
 
+    
+    /**
+     * Wait time for servlet unload in ms.
+     */
+    private long unloadDelay = 2000;
+    
 
     /**
      * True if this StandardWrapper is for the JspServlet
@@ -466,6 +472,7 @@
                 (sm.getString("standardWrapper.notContext"));
         if (container instanceof StandardContext) {
             swallowOutput = ((StandardContext)container).getSwallowOutput();
+            unloadDelay = ((StandardContext)container).getUnloadDelay();
         }
         super.setParent(container);
 
@@ -1286,13 +1293,14 @@
         // (possibly more than once if non-STM)
         if (countAllocated > 0) {
             int nRetries = 0;
+            long delay = unloadDelay / 20;
             while ((nRetries < 21) && (countAllocated > 0)) {
                 if ((nRetries % 10) == 0) {
                     log.info(sm.getString("standardWrapper.waiting",
                                           new Integer(countAllocated)));
                 }
                 try {
-                    Thread.sleep(100);
+                    Thread.sleep(delay);
                 } catch (InterruptedException e) {
                     ;
                 }

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml?rev=345286&r1=345285&r2=345286&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml (original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml Thu Nov 17 09:00:24 2005
@@ -203,6 +203,10 @@
                description="Flag to set to cause the system.out and system.err to be redirected to the logger when executing a servlet"
                type="boolean"/>
                
+    <attribute name="unloadDelay"
+               description="Amount of ms that the container will wait for servlets to unload"
+               type="long"/>
+               
     <attribute name="tldScanTime"
                description="Time spend scanning jars for TLDs for this context"
                type="long"/>



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