TServerTransport serverTransport = tcpKeepAlive ?
new TServerSocketKeepAlive(port) : new TServerSocket(port);
TProcessor processor;
TTransportFactory transFactory;
if (useSasl) {
// we are in secure mode.
saslServer = bridge.createServer(
conf.getVar(HiveConf.ConfVars.METASTORE_KERBEROS_KEYTAB_FILE),
conf.getVar(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL));
// start delegation token manager
saslServer.startDelegationTokenSecretManager(conf);
transFactory = saslServer.createTransportFactory();
processor = saslServer.wrapProcessor(new ThriftHiveMetastore.Processor<HMSHandler>(
new HMSHandler("new db based metaserver", conf)));
LOG.info("Starting DB backed MetaStore Server in Secure Mode");
} else {
// we are in unsecure mode.
HMSHandler handler = new HMSHandler("new db based metaserver", conf);
if (conf.getBoolVar(ConfVars.METASTORE_EXECUTE_SET_UGI)) {
transFactory = new TUGIContainingTransport.Factory();
processor = new TUGIBasedProcessor<HMSHandler>(handler);
LOG.info("Starting DB backed MetaStore Server with SetUGI enabled");
} else {
transFactory = new TTransportFactory();
processor = new TSetIpAddressProcessor<HMSHandler>(handler);
LOG.info("Starting DB backed MetaStore Server");
}
}