jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1380563 - /jmeter/trunk/src/examples/org/apache/jmeter/examples/sampler/ExampleSampler.java
Date Tue, 04 Sep 2012 11:26:20 GMT
Author: pmouawad
Date: Tue Sep  4 11:26:20 2012
New Revision: 1380563

URL: http://svn.apache.org/viewvc?rev=1380563&view=rev
Log:
Use Atomic classCount

Modified:
    jmeter/trunk/src/examples/org/apache/jmeter/examples/sampler/ExampleSampler.java

Modified: jmeter/trunk/src/examples/org/apache/jmeter/examples/sampler/ExampleSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/examples/org/apache/jmeter/examples/sampler/ExampleSampler.java?rev=1380563&r1=1380562&r2=1380563&view=diff
==============================================================================
--- jmeter/trunk/src/examples/org/apache/jmeter/examples/sampler/ExampleSampler.java (original)
+++ jmeter/trunk/src/examples/org/apache/jmeter/examples/sampler/ExampleSampler.java Tue Sep
 4 11:26:20 2012
@@ -18,6 +18,8 @@
 
 package org.apache.jmeter.examples.sampler;
 
+import java.util.concurrent.atomic.AtomicInteger;
+
 import org.apache.jmeter.samplers.AbstractSampler;
 import org.apache.jmeter.samplers.Entry;
 import org.apache.jmeter.samplers.SampleResult;
@@ -47,12 +49,12 @@ public class ExampleSampler extends Abst
     // The name of the property used to hold our data
     public static final String DATA = "ExampleSampler.data"; //$NON-NLS-1$
 
-    private static int classCount = 0; // keep track of classes created
+    private static AtomicInteger classCount = new AtomicInteger(0); // keep track of classes
created
 
     // (for instructional purposes only!)
 
     public ExampleSampler() {
-        classCount++;
+        classCount.incrementAndGet();
         trace("ExampleSampler()");
     }
 
@@ -120,6 +122,6 @@ public class ExampleSampler extends Abst
         String tl = getTitle();
         String tn = Thread.currentThread().getName();
         String th = this.toString();
-        log.debug(tn + " (" + classCount + ") " + tl + " " + s + " " + th);
+        log.debug(tn + " (" + classCount.get() + ") " + tl + " " + s + " " + th);
     }
 }
\ No newline at end of file



Mime
View raw message