[jboss-cvs] JBossAS SVN: r91448 - projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/statistics.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 20 17:21:18 EDT 2009
Author: ALRubinger
Date: 2009-07-20 17:21:18 -0400 (Mon, 20 Jul 2009)
New Revision: 91448
Modified:
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/statistics/InvocationStatistics.java
Log:
[EJBTHREE-1872] resetStats should clear all method invocations
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/statistics/InvocationStatistics.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/statistics/InvocationStatistics.java 2009-07-20 21:13:23 UTC (rev 91447)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/statistics/InvocationStatistics.java 2009-07-20 21:21:18 UTC (rev 91448)
@@ -23,6 +23,7 @@
import java.io.Serializable;
import java.lang.reflect.Method;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -69,12 +70,12 @@
}
/** Update the TimeStatistic for the given method. This synchronizes on
- * m to ensure that the TimeStatistic for m is updated atomically.
+ * this to ensure that the TimeStatistic for m is updated atomically.
*
* @param m the method to update the statistics for.
* @param elapsed the elapsed time in milliseconds for the invocation.
*/
- public void updateStats(Method m, long elapsed)
+ public synchronized void updateStats(Method m, long elapsed)
{
TimeStatistic stat = (TimeStatistic) methodStats.get(m.getName());
if (stat == null)
@@ -105,28 +106,20 @@
/** Resets all current TimeStatistics.
*
*/
- public void resetStats()
+ public synchronized void resetStats()
{
- synchronized (methodStats)
- {
- Iterator<TimeStatistic> iter = methodStats.values().iterator();
- while (iter.hasNext())
- {
- TimeStatistic stat = (TimeStatistic) iter.next();
- stat.reset();
- }
- }
+ methodStats.clear();
maxConcurrentCalls = 0;
lastResetTime = System.currentTimeMillis();
}
- /** Access the current collection of method invocation statistics
+ /** Accesses an immutable view of the current collection of method invocation statistics
*
* @return A HashMap<Method, TimeStatistic> of the method invocations
*/
public Map<String,TimeStatistic> getStats()
{
- return methodStats;
+ return Collections.unmodifiableMap(methodStats);
}
/** Generate an XML fragement for the InvocationStatistics. The format is
More information about the jboss-cvs-commits
mailing list