You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2013/02/27 23:04:31 UTC

svn commit: r1450992 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/core/StandardContext.java java/org/apache/catalina/core/mbeans-descriptors.xml webapps/docs/changelog.xml

Author: rjung
Date: Wed Feb 27 22:04:30 2013
New Revision: 1450992

URL: http://svn.apache.org/r1450992
Log:
Add more status data to the webapp MBean.

Like for processingTime retrieve it by
iterating over the children.

Backport of r1450990 from trunk.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1450990

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1450992&r1=1450991&r2=1450992&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java Wed Feb 27 22:04:30 2013
@@ -4494,6 +4494,96 @@ public class StandardContext extends Con
         return result;
     }
 
+    /**
+     * Gets the maximum processing time of all servlets in this
+     * StandardContext.
+     *
+     * @return Maximum processing time of all servlets in this
+     * StandardContext
+     */
+    public long getMaxTime() {
+
+        long result = 0;
+        long time;
+
+        Container[] children = findChildren();
+        if (children != null) {
+            for( int i=0; i< children.length; i++ ) {
+                time = ((StandardWrapper)children[i]).getMaxTime();
+                if (time > result)
+                    result = time;
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * Gets the minimum processing time of all servlets in this
+     * StandardContext.
+     *
+     * @return Minimum processing time of all servlets in this
+     * StandardContext
+     */
+    public long getMinTime() {
+
+        long result = -1;
+        long time;
+
+        Container[] children = findChildren();
+        if (children != null) {
+            for( int i=0; i< children.length; i++ ) {
+                time = ((StandardWrapper)children[i]).getMinTime();
+                if (result < 0 || time < result)
+                    result = time;
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * Gets the cumulative request count of all servlets in this
+     * StandardContext.
+     *
+     * @return Cumulative request count of all servlets in this
+     * StandardContext
+     */
+    public int getRequestCount() {
+
+        int result = 0;
+
+        Container[] children = findChildren();
+        if (children != null) {
+            for( int i=0; i< children.length; i++ ) {
+                result += ((StandardWrapper)children[i]).getRequestCount();
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * Gets the cumulative error count of all servlets in this
+     * StandardContext.
+     *
+     * @return Cumulative error count of all servlets in this
+     * StandardContext
+     */
+    public int getErrorCount() {
+
+        int result = 0;
+
+        Container[] children = findChildren();
+        if (children != null) {
+            for( int i=0; i< children.length; i++ ) {
+                result += ((StandardWrapper)children[i]).getErrorCount();
+            }
+        }
+
+        return result;
+    }
+
 
     /**
      * Return the real path for a given virtual path, if possible; otherwise

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml?rev=1450992&r1=1450991&r2=1450992&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml Wed Feb 27 22:04:30 2013
@@ -264,6 +264,26 @@
                type="long"
                writeable="false" />
                
+    <attribute name="maxTime"
+               description="Maximum execution time of all servlets in this context"
+               type="long"
+               writeable="false" />
+
+    <attribute name="minTime"
+               description="Minimum execution time of all servlets in this context"
+               type="long"
+               writeable="false" />
+
+    <attribute name="requestCount"
+               description="Cumulative request count of all servlets in this context"
+               type="int"
+               writeable="false" />
+
+    <attribute name="errorCount"
+               description="Cumulative error count of all servlets in this context"
+               type="int"
+               writeable="false" />
+
     <attribute name="publicId"
                description="The public identifier of the DTD for the web application deployment descriptor version that is being parsed"
                type="java.lang.String"

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1450992&r1=1450991&r2=1450992&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Feb 27 22:04:30 2013
@@ -77,6 +77,10 @@
         (<code>scanBootstrapClassPath</code>) to control if the bootstrap
         classpath is scanned or not. By default, it will not be scanned. (markt)
       </add>
+      <update>
+        Provide more consolidated servlet MBean data in the webapp MBean.
+        (rjung)
+      </update>
     </changelog>
   </subsection>
   <subsection name="Web applications">



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