if (ClusterImpl.DEBUG) {
logger.log(logger.INFO, "ClusterImpl.initSSLListener[nodelay="+nodelay+
", inbufsz="+callback.getSSLInputBufferSize()+", outbufsz="+callback.getSSLOutputBufferSize()+"]");
}
ServerSocketFactory sslfactory = null;
try {
/* This can be called as a result of cluster property update.
* Hence does not do System.exit here.
* Cluster.start() Exception will cause System.exit,
*/
LicenseBase license = Globals.getCurrentLicense(null);
if (!license.getBooleanProperty(license.PROP_ENABLE_SSL, false)) {
logger.log(Logger.ERROR, br.E_FATAL_FEATURE_UNAVAILABLE,
br.getString(br.M_SSL_BROKER_CLUSTERS));
throw new BrokerException(br.getKString(br.E_FATAL_FEATURE_UNAVAILABLE,
br.getString(br.M_SSL_BROKER_CLUSTERS)));
}
Class TLSProtocolClass = Class.forName(
"com.sun.messaging.jmq.jmsserver.net.tls.TLSProtocol");
if (ClusterImpl.DEBUG) {
logger.log(logger.DEBUG, "ClusterImpl.initSSLListener. " +
"Initializing SSLServerSocketFactory");
}
/* SSLServerSocketFactory ssf = (SSLServerSocketFactory)
TLSProtocol.getServerSocketFactory(); */
java.lang.reflect.Method m = TLSProtocolClass.getMethod("getServerSocketFactory", null);
sslfactory = (ServerSocketFactory)m.invoke(null, null);
}
catch (Exception e) {
Throwable t = e;
if (e instanceof java.lang.reflect.InvocationTargetException) {
t = e.getCause();
if (t == null) t = e;
if (ClusterImpl.DEBUG && t != e) {
logger.logStack(Logger.ERROR, e.getMessage(), e);
}
}
logger.logStack(Logger.ERROR, t.getMessage(), t);
throw new IOException(t.getMessage());
}
InetAddress listenHost = callback.getListenHost();
int listenPort = callback.getListenPort();
HashMap h = null;
if (ClusterImpl.DEBUG) {
logger.log(logger.DEBUG, "ClusterImpl.initSSLListener. " +
"Initializing ServerSocket");
}
if (listenHost == null) {
ss = sslfactory.createServerSocket(listenPort);
}
else {
ss = sslfactory.createServerSocket(listenPort, 50, listenHost);
// Why backlog = 50? According the JDK 1.4 javadoc,
// that's the default value for ServerSocket().
// Also even if a connection gets refused, that broker
// will try again after sometime anyway...