Author: sebb
Date: Thu May 15 10:25:12 2008
New Revision: 656750
URL: http://svn.apache.org/viewvc?rev=656750&view=rev
Log:
Synchronization has been removed from the RunningSample class (it was not fully
threadsafe anyway). Developers of 3rd party add-ons that use the class may need
to synchronize access.
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/RunningSample.java
jakarta/jmeter/trunk/xdocs/changes.xml
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/RunningSample.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/RunningSample.java?rev=656750&r1=656749&r2=656750&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/RunningSample.java
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/RunningSample.java
Thu May 15 10:25:12 2008
@@ -23,9 +23,17 @@
import org.apache.jmeter.samplers.SampleResult;
/**
- * Aggegate sample data container. Just instantiate a new instance of this
+ * <p>
+ * Running sample data container. Just instantiate a new instance of this
* class, and then call [EMAIL PROTECTED] #addSample(SampleResult)} a few
times, and pull
* the stats out with whatever methods you prefer.
+ * </p>
+ * <p>
+ * Please note that this class is not thread-safe.
+ * The calling class is responsible for ensuring thread safety if required.
+ * Versions prior to 2.3.2 appeared to be thread-safe but weren't as label and
index were not final.
+ * Also the caller needs to synchronize access in order to enure that
variables are consistent.
+ * </p>
*
*/
public class RunningSample {
@@ -34,25 +42,24 @@
private static final DecimalFormat errorFormatter = new
DecimalFormat("#0.00%"); // $NON-NLS-1$
- // The counts all need to be volatile - or else the get() methods need
to be synchronised.
-
- private volatile long counter;
+ private long counter;
- private volatile long runningSum;
+ private long runningSum;
- private volatile long max, min;
+ private long max, min;
- private volatile long errorCount;
+ private long errorCount;
- private volatile long firstTime;
+ private long firstTime;
- private volatile long lastTime;
+ private long lastTime;
- private String label;
+ private final String label;
- private int index;
+ private final int index;
private RunningSample() {// Don't (can't) use this...
+ this("", 0);
}
/**
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=656750&r1=656749&r2=656750&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Thu May 15 10:25:12 2008
@@ -117,6 +117,10 @@
Leading and trailing spaces are trimmed from variable names in function calls.
For example, ${__Random(1,63, LOTTERY )} will use the variable 'LOTTERY'
rather than ' LOTTERY '.
</li>
+<li>
+Synchronization has been removed from the RunningSample class (it was not
fully threadsafe anyway).
+Developers of 3rd party add-ons that use the class may need to synchronize
access.
+</li>
</ul>
<h4>Bug fixes</h4>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]