Improve thread-safety

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@799233 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2009-07-30 10:52:00 +00:00
parent 3629ccf108
commit c94fb12752
1 changed files with 3 additions and 1 deletions

View File

@ -178,7 +178,9 @@ public class SSLSocketFactory implements LayeredSocketFactory {
private final SSLContext sslcontext; private final SSLContext sslcontext;
private final javax.net.ssl.SSLSocketFactory socketfactory; private final javax.net.ssl.SSLSocketFactory socketfactory;
private final HostNameResolver nameResolver; private final HostNameResolver nameResolver;
private X509HostnameVerifier hostnameVerifier = BROWSER_COMPATIBLE_HOSTNAME_VERIFIER;
// volatile is needed to guarantee thread-safety of the setter/getter methods under all usage scenarios
private volatile X509HostnameVerifier hostnameVerifier = BROWSER_COMPATIBLE_HOSTNAME_VERIFIER;
public SSLSocketFactory( public SSLSocketFactory(
String algorithm, String algorithm,