jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1854648 - /jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
Date Sat, 02 Mar 2019 14:40:42 GMT
Author: fschumacher
Date: Sat Mar  2 14:40:42 2019
New Revision: 1854648

URL: http://svn.apache.org/viewvc?rev=1854648&view=rev
Log:
Use Collections#newSetFromMap to generate a Set from a CHM.

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java?rev=1854648&r1=1854647&r2=1854648&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java Sat Mar  2 14:40:42
2019
@@ -25,8 +25,9 @@ import java.net.URL;
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
-import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
 
@@ -47,7 +48,7 @@ import org.slf4j.LoggerFactory;
  *
  */
 public class SampleResult implements Serializable, Cloneable, Searchable {
-    private static final Byte MARKER = Byte.valueOf((byte) 0);
+
     private static final long serialVersionUID = 241L;
 
     // Needs to be accessible from Test code
@@ -215,7 +216,7 @@ public class SampleResult implements Ser
      * In Non GUI mode and when best config is used, size never exceeds 1,
      * but as a compromise set it to 2
      */
-    private final Map<String, Byte> files = new ConcurrentHashMap<>(2);
+    private final Set<String> files = Collections.newSetFromMap(new ConcurrentHashMap<String,
Boolean>(2));
 
     // TODO do contentType and/or dataEncoding belong in HTTPSampleResult instead?
     private String dataEncoding;// (is this really the character set?) e.g.
@@ -500,8 +501,7 @@ public class SampleResult implements Ser
      * @return <code>true</code> if the result was previously marked
      */
     public boolean markFile(String filename) {
-        Byte previousMarker = files.putIfAbsent(filename, MARKER);
-        return previousMarker != null;
+        return !files.add(filename);
     }
 
     public String getResponseCode() {



Mime
View raw message