Author: sebb
Date: Thu Mar 8 10:05:47 2007
New Revision: 516124
URL: http://svn.apache.org/viewvc?view=rev&rev=516124
Log:
Make counter volatile (else can return wrong value)
Modified:
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/visualizers/RunningSample.java
Modified:
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/visualizers/RunningSample.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/visualizers/RunningSample.java?view=diff&rev=516124&r1=516123&r2=516124
==============================================================================
---
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/visualizers/RunningSample.java
(original)
+++
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/visualizers/RunningSample.java
Thu Mar 8 10:05:47 2007
@@ -35,7 +35,9 @@
private static DecimalFormat errorFormatter = new
DecimalFormat("#0.00%");
- private long counter;
+ // The counts all need to be volatile - or else the get() methods need
to be synchronised.
+
+ private volatile long counter;
private volatile long runningSum;
@@ -55,7 +57,7 @@
}
/**
- * Use this constructor.
+ * Use this constructor to create the initial instance
*/
public RunningSample(String label, int index) {
this.label = label;
@@ -64,11 +66,10 @@
}
/**
- * Copy constructor to a duplicate of existing instance (without the
- * disadvantages of clone()0
+ * Copy constructor to create a duplicate of existing instance (without
the
+ * disadvantages of clone()
*
- * @param src
- * RunningSample
+ * @param src existing RunningSample to be copied
*/
public RunningSample(RunningSample src) {
this.counter = src.counter;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]