jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1769406 - /jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java
Date Sat, 12 Nov 2016 20:24:46 GMT
Author: pmouawad
Date: Sat Nov 12 20:24:46 2016
New Revision: 1769406

URL: http://svn.apache.org/viewvc?rev=1769406&view=rev
Log:
Fix naming of static var
Fix synchronization

Modified:
    jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java

Modified: jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java?rev=1769406&r1=1769405&r2=1769406&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java
(original)
+++ jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java
Sat Nov 12 20:24:46 2016
@@ -21,6 +21,7 @@ package org.apache.jmeter.protocol.ldap.
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -87,7 +88,7 @@ public class LDAPSampler extends Abstrac
 
     // For In build test case using this counter
     // create the new entry in the server
-    private static volatile int counter = 0;
+    private static AtomicInteger COUNTER = new AtomicInteger(0);
 
     private boolean searchFoundEntries;// TODO turn into parameter?
 
@@ -330,13 +331,13 @@ public class LDAPSampler extends Abstrac
         String s3 = "Test"; //$NON-NLS-1$
         String s5 = "user"; //$NON-NLS-1$
         String s6 = "test"; //$NON-NLS-1$
-        counter += 1;
+        COUNTER.incrementAndGet();
         basicattributes.put(new BasicAttribute("givenname", s1)); //$NON-NLS-1$
         basicattributes.put(new BasicAttribute("sn", s3)); //$NON-NLS-1$
-        basicattributes.put(new BasicAttribute("cn", "TestUser" + counter)); //$NON-NLS-1$
//$NON-NLS-2$
+        basicattributes.put(new BasicAttribute("cn", "TestUser" + COUNTER.get())); //$NON-NLS-1$
//$NON-NLS-2$
         basicattributes.put(new BasicAttribute("uid", s5)); //$NON-NLS-1$
         basicattributes.put(new BasicAttribute("userpassword", s6)); //$NON-NLS-1$
-        setProperty(new StringProperty(ADD, "cn=TestUser" + counter)); //$NON-NLS-1$
+        setProperty(new StringProperty(ADD, "cn=TestUser" + COUNTER.get())); //$NON-NLS-1$
         return basicattributes;
     }
 



Mime
View raw message