Author: fschumacher
Date: Sat Mar 23 19:20:32 2019
New Revision: 1856123

URL: http://svn.apache.org/viewvc?rev=1856123&view=rev
Log:
Correct synchronized usage of field

Most of the time the file keyStore was already used inside a synchronized block 
and volatile
is not a good idea to be used for non primitive types, so use synchronized for 
the rest of the
simple methods that use keyStore as field.

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/util/SSLManager.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/SSLManager.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/SSLManager.java?rev=1856123&r1=1856122&r2=1856123&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/util/SSLManager.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/SSLManager.java Sat Mar 23 
19:20:32 2019
@@ -65,10 +65,10 @@ public abstract class SSLManager {
     private static final boolean IS_SSL_SUPPORTED = true;
 
     /** Cache the KeyStore instance */
-    private volatile JmeterKeyStore keyStore;
+    private JmeterKeyStore keyStore;
 
     /** Cache the TrustStore instance - null if no truststore name was 
provided */
-    private KeyStore trustStore = null;
+    private volatile KeyStore trustStore = null;
     // Have we yet tried to load the truststore?
     private volatile boolean truststoreLoaded=false;
 
@@ -282,7 +282,7 @@ public abstract class SSLManager {
      *            name of the default key, if empty the first key will be used
      *            as default key
      */
-    public void configureKeystore(boolean preload, int startIndex, int 
endIndex, String clientCertAliasVarName) {
+    public synchronized void configureKeystore(boolean preload, int 
startIndex, int endIndex, String clientCertAliasVarName) {
         this.keystoreAliasStartIndex = startIndex;
         this.keystoreAliasEndIndex = endIndex;
         this.clientCertAliasVarName = clientCertAliasVarName;
@@ -294,7 +294,7 @@ public abstract class SSLManager {
     /**
      * Destroy Keystore
      */
-    public void destroyKeystore() {
+    public synchronized void destroyKeystore() {
         keyStore=null;
     }
 }


Reply via email to