jerryshao commented on code in PR #8252:
URL: https://github.com/apache/gravitino/pull/8252#discussion_r2303081694


##########
catalogs/catalog-fileset/src/main/java/org/apache/gravitino/catalog/fileset/SecureFilesetCatalogOperations.java:
##########
@@ -271,6 +280,211 @@ public void close() throws IOException {
     catalogUserContext.close();
 
     UserContext.cleanAllUserContext();
+
+    boolean testEnv = System.getenv("GRAVITINO_TEST") != null;
+    if (testEnv) {
+      // In test environment, we do not need to clean up class loader related 
stuff
+      return;
+    }
+
+    try {
+      closeStatsDataClearerInFileSystem();
+
+      stopThreadsAndClearThreadLocal();
+
+      // Release the LogFactory for the FilesetCatalogOperations class loader
+      unregisterLogFactory();
+
+      closeResourceInAWS();
+
+      closeResourceInGCP();
+
+      closeResourceInAzure();
+
+      clearShutdownHooks();
+    } catch (Exception e) {
+      LOG.warn("Failed to clear resources(Thread, ThreadLocal variants) in the 
class loader", e);
+    }
+  }
+
+  private static void stopThreadsAndClearThreadLocal() {

Review Comment:
   "ThreadLocalVariables"



-- 
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