jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1779803 - in /jmeter/trunk/src/protocol: http/org/apache/jmeter/protocol/http/parser/ http/org/apache/jmeter/protocol/http/sampler/ http/org/apache/jmeter/protocol/http/util/ jdbc/org/apache/jmeter/protocol/jdbc/config/ tcp/org/apache/jmet...
Date Sun, 22 Jan 2017 12:50:18 GMT
Author: fschumacher
Date: Sun Jan 22 12:50:17 2017
New Revision: 1779803

URL: http://svn.apache.org/viewvc?rev=1779803&view=rev
Log:
Utilised Java 8 (and 7) features to tidy up code. Used ThreadLocal.withInital. Contributed
by Graham Russell (graham at ham1.co.uk). Part 3/8 of github pr #255

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HC4TrustAllSSLSocketFactory.java
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
    jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java?rev=1779803&r1=1779802&r2=1779803&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java
Sun Jan 22 12:50:17 2017
@@ -117,12 +117,7 @@ class RegexpHTMLParser extends HTMLParse
      * Thread-local input:
      */
     private static final ThreadLocal<PatternMatcherInput> localInput =
-        new ThreadLocal<PatternMatcherInput>() {
-        @Override
-        protected PatternMatcherInput initialValue() {
-            return new PatternMatcherInput(new char[0]);
-        }
-    };
+            ThreadLocal.withInitial(() -> new PatternMatcherInput(new char[0]));
 
     /**
      * Make sure to compile the regular expression upon instantiation:

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java?rev=1779803&r1=1779802&r2=1779803&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
Sun Jan 22 12:50:17 2017
@@ -102,13 +102,8 @@ public class HTTPHC3Impl extends HTTPHCA
 
     private static final boolean CAN_SET_PREEMPTIVE; // OK to set pre-emptive auth?
 
-    private static final ThreadLocal<Map<HostConfiguration, HttpClient>> httpClients
= 
-        new ThreadLocal<Map<HostConfiguration, HttpClient>>(){
-        @Override
-        protected Map<HostConfiguration, HttpClient> initialValue() {
-            return new HashMap<>();
-        }
-    };
+    private static final ThreadLocal<Map<HostConfiguration, HttpClient>> httpClients
=
+            ThreadLocal.withInitial(HashMap::new);
 
     // Needs to be accessible by HTTPSampler2
     volatile HttpClient savedClient;

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HC4TrustAllSSLSocketFactory.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HC4TrustAllSSLSocketFactory.java?rev=1779803&r1=1779802&r2=1779803&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HC4TrustAllSSLSocketFactory.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HC4TrustAllSSLSocketFactory.java
Sun Jan 22 12:50:17 2017
@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.net.Socket;
 import java.net.UnknownHostException;
 import java.security.GeneralSecurityException;
-import java.security.cert.X509Certificate;
 
 import javax.net.ssl.SSLSocket;
 

Modified: jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java?rev=1779803&r1=1779802&r2=1779803&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
(original)
+++ jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
Sun Jan 22 12:50:17 2017
@@ -254,12 +254,7 @@ public class DataSourceElement extends A
 
     // used to hold per-thread singleton connection pools
     private static final ThreadLocal<Map<String, BasicDataSource>> perThreadPoolMap
=
-        new ThreadLocal<Map<String, BasicDataSource>>(){
-        @Override
-        protected Map<String, BasicDataSource> initialValue() {
-            return new HashMap<>();
-        }
-    };
+            ThreadLocal.withInitial(HashMap::new);
 
     /*
      * Wrapper class to allow getConnection() to be implemented for both shared

Modified: jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java?rev=1779803&r1=1779802&r2=1779803&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java (original)
+++ jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java Sun
Jan 22 12:50:17 2017
@@ -131,12 +131,7 @@ public class TCPSampler extends Abstract
     /** the cache of TCP Connections */
     // KEY = TCPKEY or ERRKEY, Entry= Socket or String
     private static final ThreadLocal<Map<String, Object>> tp =
-        new ThreadLocal<Map<String, Object>>() {
-        @Override
-        protected Map<String, Object> initialValue() {
-            return new HashMap<>();
-        }
-    };
+            ThreadLocal.withInitial(HashMap::new);
 
     private transient TCPClient protocolHandler;
     



Mime
View raw message