jerqi commented on code in PR #9458:
URL: https://github.com/apache/gravitino/pull/9458#discussion_r2609435127


##########
catalogs/hive-metastore-common/src/main/java/org/apache/gravitino/hive/client/HiveClientFactory.java:
##########
@@ -180,18 +213,44 @@ private HiveClient 
createHiveClientInternal(HiveClientClassLoader classloader) {
     }
   }
 
+  private void initKerberosIfNecessary() {
+    try {
+      AuthenticationConfig authenticationConfig = new 
AuthenticationConfig(properties, hadoopConf);
+      enableKerberos = authenticationConfig.isKerberosAuth();
+      enableImpersonation = authenticationConfig.isImpersonationEnable();
+      if (!enableKerberos) {
+        return;
+      }
+
+      kerberosClient = new KerberosClient(properties, hadoopConf, true, 
keytabPath);
+      kerberosClient.login();
+
+    } catch (Exception e) {
+      throw new RuntimeException("Failed to initialize kerberos client", e);
+    }
+  }
+
   /** Release resources held by this factory. */
   public void close() {
-    synchronized (classLoaderLock) {
-      try {
+    try {
+      if (kerberosClient != null) {
+        try {

Review Comment:
   Do we need two levels `try catch`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to