< prev index next >

src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java

Print this page

        

*** 27,37 **** import java.net.Socket; import java.security.*; import java.security.cert.*; import java.util.*; - import java.util.concurrent.locks.ReentrantLock; import javax.net.ssl.*; import sun.security.util.AnchorCertificates; import sun.security.util.HostnameChecker; import sun.security.validator.*; --- 27,36 ----
*** 62,73 **** // note that we need separate validator for client and server due to // the different extension checks. They are initialized lazily on demand. private volatile Validator clientValidator, serverValidator; - private final ReentrantLock validatorLock = new ReentrantLock(); - X509TrustManagerImpl(String validatorType, Collection<X509Certificate> trustedCerts) { this.validatorType = validatorType; this.pkixParams = null; --- 61,70 ----
*** 158,192 **** Validator v = null; if (isClient) { v = clientValidator; if (v == null) { ! validatorLock.lock(); ! try { v = clientValidator; if (v == null) { v = getValidator(Validator.VAR_TLS_CLIENT); clientValidator = v; } - } finally { - validatorLock.unlock(); } } } else { // assume double checked locking with a volatile flag works // (guaranteed under the new Tiger memory model) v = serverValidator; if (v == null) { ! validatorLock.lock(); ! try { v = serverValidator; if (v == null) { v = getValidator(Validator.VAR_TLS_SERVER); serverValidator = v; } - } finally { - validatorLock.unlock(); } } } return v; --- 155,183 ---- Validator v = null; if (isClient) { v = clientValidator; if (v == null) { ! synchronized (this) { v = clientValidator; if (v == null) { v = getValidator(Validator.VAR_TLS_CLIENT); clientValidator = v; } } } } else { // assume double checked locking with a volatile flag works // (guaranteed under the new Tiger memory model) v = serverValidator; if (v == null) { ! synchronized (this) { v = serverValidator; if (v == null) { v = getValidator(Validator.VAR_TLS_SERVER); serverValidator = v; } } } } return v;
< prev index next >