jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1380317 - /jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java
Date Mon, 03 Sep 2012 19:38:38 GMT
Author: pmouawad
Date: Mon Sep  3 19:38:38 2012
New Revision: 1380317

URL: http://svn.apache.org/viewvc?rev=1380317&view=rev
Log:
Remove useless synchronized
Use better Map iteration

Modified:
    jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java?rev=1380317&r1=1380316&r2=1380317&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java (original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java Mon Sep  3 19:38:38
2012
@@ -34,7 +34,7 @@ import org.apache.commons.lang3.mutable.
 public abstract class StatCalculator<T extends Number & Comparable<? super T>>
{
 
     // key is the type to collect (usually long), value = count of entries
-    private final TreeMap<T, MutableLong> valuesMap = new TreeMap<T, MutableLong>();
+    private final Map<T, MutableLong> valuesMap = new TreeMap<T, MutableLong>();
     // We use a TreeMap because we need the entries to be sorted
 
     // Running values, updated for each sample
@@ -158,15 +158,14 @@ public abstract class StatCalculator<T e
      * @return map containing either Integer or Long keys; entries are a Number array containing
the key and the [Integer] count.
      * TODO - why is the key value also stored in the entry array?
      */
-    public synchronized Map<Number, Number[]> getDistribution() {
-        HashMap<Number, Number[]> items = new HashMap <Number, Number[]> ();
-        Number[] dis;
-
-        for (T nx : valuesMap.keySet()) {
-            dis = new Number[2];
-            dis[0] = nx;
-            dis[1] = valuesMap.get(nx);
-            items.put(nx, dis);
+    public Map<Number, Number[]> getDistribution() {
+        Map<Number, Number[]> items = new HashMap<Number, Number[]>();
+
+        for (Entry<T, MutableLong> entry : valuesMap.entrySet()) {
+            Number[] dis = new Number[2];
+            dis[0] = entry.getKey();
+            dis[1] = entry.getValue();
+            items.put(entry.getKey(), dis);
         }
         return items;
     }



Mime
View raw message