jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1521665 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Date Tue, 10 Sep 2013 22:14:53 GMT
Author: sebb
Date: Tue Sep 10 22:14:52 2013
New Revision: 1521665

URL: http://svn.apache.org/r1521665
Log:
Code:Inconsistent synchronization
AtomicBoolean and AtomicInt are not necessary when values are simply written and read and
the previous value is irrelevant (e.g. AtomicInt would be needed if the value was incremented)
Bugzilla Id: 52266

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

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java?rev=1521665&r1=1521664&r2=1521665&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Tue Sep 10 22:14:52 2013
@@ -36,8 +36,6 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.prefs.Preferences;
 
 import org.apache.commons.io.IOUtils;
@@ -226,19 +224,19 @@ public class ProxyControl extends Generi
 
     private transient KeyStore keyStore;
 
-    private AtomicBoolean addAssertions = new AtomicBoolean(false);
+    private volatile boolean addAssertions = false;
 
-    private AtomicInteger groupingMode = new AtomicInteger(0);
+    private volatile int groupingMode = 0;
 
-    private AtomicBoolean samplerRedirectAutomatically = new AtomicBoolean(false);
+    private volatile boolean samplerRedirectAutomatically = false;
 
-    private AtomicBoolean samplerFollowRedirects = new AtomicBoolean(false);
+    private volatile boolean samplerFollowRedirects = false;
 
-    private AtomicBoolean useKeepAlive = new AtomicBoolean(false);
+    private volatile boolean useKeepAlive = false;
 
-    private AtomicBoolean samplerDownloadImages = new AtomicBoolean(false);
+    private volatile boolean samplerDownloadImages = false;
 
-    private AtomicBoolean regexMatch = new AtomicBoolean(false);// Should we match using
regexes?
+    private volatile boolean regexMatch = false;// Should we match using regexes?
 
     /**
      * Tree node where the samples should be stored.
@@ -279,12 +277,12 @@ public class ProxyControl extends Generi
     }
 
     public void setGroupingMode(int grouping) {
-        this.groupingMode.set(grouping);
+        this.groupingMode = grouping;
         setProperty(new IntegerProperty(GROUPING_MODE, grouping));
     }
 
     public void setAssertions(boolean b) {
-        addAssertions.set(b);
+        addAssertions = b;
         setProperty(new BooleanProperty(ADD_ASSERTIONS, b));
     }
 
@@ -297,12 +295,12 @@ public class ProxyControl extends Generi
         setProperty(new StringProperty(SAMPLER_TYPE_NAME, samplerTypeName));
     }
     public void setSamplerRedirectAutomatically(boolean b) {
-        samplerRedirectAutomatically.set(b);
+        samplerRedirectAutomatically = b;
         setProperty(new BooleanProperty(SAMPLER_REDIRECT_AUTOMATICALLY, b));
     }
 
     public void setSamplerFollowRedirects(boolean b) {
-        samplerFollowRedirects.set(b);
+        samplerFollowRedirects = b;
         setProperty(new BooleanProperty(SAMPLER_FOLLOW_REDIRECTS, b));
     }
 
@@ -310,12 +308,12 @@ public class ProxyControl extends Generi
      * @param b
      */
     public void setUseKeepAlive(boolean b) {
-        useKeepAlive.set(b);
+        useKeepAlive = b;
         setProperty(new BooleanProperty(USE_KEEPALIVE, b));
     }
 
     public void setSamplerDownloadImages(boolean b) {
-        samplerDownloadImages.set(b);
+        samplerDownloadImages = b;
         setProperty(new BooleanProperty(SAMPLER_DOWNLOAD_IMAGES, b));
     }
 
@@ -331,7 +329,7 @@ public class ProxyControl extends Generi
      * @param b
      */
     public void setRegexMatch(boolean b) {
-        regexMatch.set(b);
+        regexMatch = b;
         setProperty(new BooleanProperty(REGEX_MATCH, b));
     }
 
@@ -494,10 +492,10 @@ public class ProxyControl extends Generi
 
                 removeValuesFromSampler(sampler, defaultConfigurations);
                 replaceValues(sampler, subConfigs, userDefinedVariables);
-                sampler.setAutoRedirects(samplerRedirectAutomatically.get());
-                sampler.setFollowRedirects(samplerFollowRedirects.get());
-                sampler.setUseKeepAlive(useKeepAlive.get());
-                sampler.setImageParser(samplerDownloadImages.get());
+                sampler.setAutoRedirects(samplerRedirectAutomatically);
+                sampler.setFollowRedirects(samplerFollowRedirects);
+                sampler.setUseKeepAlive(useKeepAlive);
+                sampler.setImageParser(samplerDownloadImages);
 
                 placeSampler(sampler, subConfigs, myTarget);
             } else {
@@ -895,7 +893,7 @@ public class ProxyControl extends Generi
             boolean firstInBatch = false;
             long now = System.currentTimeMillis();
             long deltaT = now - lastTime;
-            int cachedGroupingMode = groupingMode.get();
+            int cachedGroupingMode = groupingMode;
             if (deltaT > sampleGap) {
                 if (!myTarget.isLeaf() && cachedGroupingMode == GROUPING_ADD_SEPARATORS)
{
                     addDivider(treeModel, myTarget);
@@ -945,7 +943,7 @@ public class ProxyControl extends Generi
                     try {
                         final JMeterTreeNode newNode = treeModel.addComponent(sampler, myTargetFinal);
                         if (firstInBatchFinal) {
-                            if (addAssertions.get()) {
+                            if (addAssertions) {
                                 addAssertion(treeModel, newNode);
                             }
                             addTimers(treeModel, newNode, deltaTFinal);
@@ -1064,7 +1062,7 @@ public class ProxyControl extends Generi
         }
 
         try {
-            boolean cachedRegexpMatch = regexMatch.get();
+            boolean cachedRegexpMatch = regexMatch;
             replacer.reverseReplace(sampler, cachedRegexpMatch);
             for (int i = 0; i < configs.length; i++) {
                 if (configs[i] != null) {



Mime
View raw message