[jboss-cvs] JBossAS SVN: r69796 - branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/statistics.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 12 11:26:02 EST 2008


Author: bdecoste
Date: 2008-02-12 11:26:02 -0500 (Tue, 12 Feb 2008)
New Revision: 69796

Modified:
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/statistics/InvocationStatistics.java
Log:
[JBPAPP-623] view InvocationStatistics via jmx-console

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/statistics/InvocationStatistics.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/statistics/InvocationStatistics.java	2008-02-12 13:17:45 UTC (rev 69795)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/statistics/InvocationStatistics.java	2008-02-12 16:26:02 UTC (rev 69796)
@@ -137,7 +137,7 @@
     *
     * @return an XML representation of the InvocationStatistics
     */
-   public String toString()
+   public String toXmlString()
    {
       StringBuffer tmp = new StringBuffer("<InvocationStatistics concurrentCalls='");
       tmp.append(concurrentCalls);
@@ -167,4 +167,34 @@
       tmp.append("</InvocationStatistics>");
       return tmp.toString();
    }
+   
+   public String toString()
+   {
+      StringBuffer tmp = new StringBuffer("InvocationStatistics concurrentCalls='");
+      tmp.append(concurrentCalls);
+      tmp.append("'\n");
+
+      HashMap copy = new HashMap(methodStats);
+      Iterator iter = copy.entrySet().iterator();
+      while (iter.hasNext())
+      {
+         Map.Entry entry = (Map.Entry) iter.next();
+         TimeStatistic stat = (TimeStatistic) entry.getValue();
+         if (stat != null)
+         {
+            tmp.append("method name='");
+            tmp.append(entry.getKey());
+            tmp.append("' count='");
+            tmp.append(stat.count);
+            tmp.append("' minTime='");
+            tmp.append(stat.minTime);
+            tmp.append("' maxTime='");
+            tmp.append(stat.maxTime);
+            tmp.append("' totalTime='");
+            tmp.append(stat.totalTime);
+            tmp.append("'\n");
+         }
+      }
+      return tmp.toString();
+   }
 }




More information about the jboss-cvs-commits mailing list