Author: rjung
Date: Wed Feb 27 21:59:05 2013
New Revision: 1450990

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

Like for processingTime retrieve it by
iterating over the children.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1450990&r1=1450989&r2=1450990&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Wed Feb 27 
21:59:05 2013
@@ -4375,6 +4375,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/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml?rev=1450990&r1=1450989&r2=1450990&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml (original)
+++ tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml Wed Feb 
27 21:59:05 2013
@@ -246,6 +246,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"



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

Reply via email to