in kyuubi-relocated-hive-metastore-client/src/main/java/org/apache/kyuubi/shaded/hive/metastore/HiveMetaStoreClient.java [398:450]
private TTransport createBinaryClient(URI store, boolean useSSL)
throws TTransportException, MetaException {
TTransport binaryTransport = null;
try {
int clientSocketTimeout =
(int)
MetastoreConf.getTimeVar(conf, ConfVars.CLIENT_SOCKET_TIMEOUT, TimeUnit.MILLISECONDS);
int connectionTimeout =
(int)
MetastoreConf.getTimeVar(
conf, ConfVars.CLIENT_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS);
if (useSSL) {
String trustStorePath = MetastoreConf.getVar(conf, ConfVars.SSL_TRUSTSTORE_PATH).trim();
if (trustStorePath.isEmpty()) {
throw new IllegalArgumentException(
ConfVars.SSL_TRUSTSTORE_PATH + " Not configured for SSL connection");
}
String trustStorePassword =
MetastoreConf.getPassword(conf, MetastoreConf.ConfVars.SSL_TRUSTSTORE_PASSWORD);
String trustStoreType = MetastoreConf.getVar(conf, ConfVars.SSL_TRUSTSTORE_TYPE).trim();
String trustStoreAlgorithm =
MetastoreConf.getVar(conf, ConfVars.SSL_TRUSTMANAGERFACTORY_ALGORITHM).trim();
binaryTransport =
SecurityUtils.getSSLSocket(
store.getHost(),
store.getPort(),
clientSocketTimeout,
connectionTimeout,
trustStorePath,
trustStorePassword,
trustStoreType,
trustStoreAlgorithm);
} else {
binaryTransport =
new TSocket(
new TConfiguration(),
store.getHost(),
store.getPort(),
clientSocketTimeout,
connectionTimeout);
}
binaryTransport = createAuthBinaryTransport(store, binaryTransport);
} catch (Exception e) {
if (e instanceof TTransportException) {
throw (TTransportException) e;
} else {
throw new MetaException(
"Failed to create binary transport client to url: " + store + ". Error: " + e);
}
}
LOG.debug("Created thrift binary client for URI: " + store);
return configureThriftMaxMessageSize(binaryTransport);
}