public static synchronized ServerSocketFactory getDefault() {
if (theFactory != null) {
return theFactory;
}
if (propertyChecked == false) {
propertyChecked = true;
String clsName = SSLSocketFactory.getSecurityProperty
("ssl.ServerSocketFactory.provider");
if (clsName != null) {
log("setting up default SSLServerSocketFactory");
try {
Class cls = null;
try {
cls = Class.forName(clsName);
} catch (ClassNotFoundException e) {
ClassLoader cl = ClassLoader.getSystemClassLoader();
if (cl != null) {
cls = cl.loadClass(clsName);
}
}
log("class " + clsName + " is loaded");
SSLServerSocketFactory fac = (SSLServerSocketFactory)cls.newInstance();
log("instantiated an instance of class " + clsName);
theFactory = fac;
return fac;
} catch (Exception e) {
log("SSLServerSocketFactory instantiation failed: " + e);
theFactory = new DefaultSSLServerSocketFactory(e);
return theFactory;
}
}
}
try {
return SSLContext.getDefault().getServerSocketFactory();
} catch (NoSuchAlgorithmException e) {
return new DefaultSSLServerSocketFactory(e);
}
}
Returns the default SSL server socket factory.
The first time this method is called, the security property
"ssl.ServerSocketFactory.provider" is examined. If it is non-null, a
class by that name is loaded and instantiated. If that is successful and
the object is an instance of SSLServerSocketFactory, it is made the
default SSL server socket factory.
Otherwise, this method returns
SSLContext.getDefault().getServerSocketFactory() . If that
call fails, an inoperative factory is returned. |