jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1769408 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/AbstractSamplerCreator.java
Date Sat, 12 Nov 2016 20:25:43 GMT
Author: pmouawad
Date: Sat Nov 12 20:25:43 2016
New Revision: 1769408

URL: http://svn.apache.org/viewvc?rev=1769408&view=rev
Log:
Fix synchronization

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/AbstractSamplerCreator.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/AbstractSamplerCreator.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/AbstractSamplerCreator.java?rev=1769408&r1=1769407&r2=1769408&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/AbstractSamplerCreator.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/AbstractSamplerCreator.java
Sat Nov 12 20:25:43 2016
@@ -24,6 +24,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.StringTokenizer;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
 import org.apache.jmeter.samplers.SampleResult;
@@ -68,7 +69,7 @@ public abstract class AbstractSamplerCre
     private static final boolean numberRequests =
         JMeterUtils.getPropDefault("proxy.number.requests", true); // $NON-NLS-1$
 
-    private static volatile int requestNumber = 0;// running number
+    private static AtomicInteger REQUEST_NUMBER = new AtomicInteger(0);// running number
     
 
     /**
@@ -85,14 +86,14 @@ public abstract class AbstractSamplerCre
      * @return int request number
      */
     protected static int getRequestNumber() {
-        return requestNumber;
+        return REQUEST_NUMBER.get();
     }
 
     /**
      * Increment request number
      */
     protected static void incrementRequestNumber() {
-        requestNumber++;
+        REQUEST_NUMBER.incrementAndGet();
     }
 
     /**



Mime
View raw message