yuqi1129 commented on code in PR #8252:
URL: https://github.com/apache/gravitino/pull/8252#discussion_r2300251359
##########
catalogs/catalog-fileset/src/main/java/org/apache/gravitino/catalog/fileset/SecureFilesetCatalogOperations.java:
##########
@@ -271,6 +280,182 @@ 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();
+
+ FileSystem.closeAll();
+
+ // Clear all thread references to the ClosableHiveCatalog class loader.
+ Thread[] threads = getAllThreads();
+ for (Thread thread : threads) {
+ // Clear thread local map for webserver threads in the current class
loader
+ clearThreadLocalMap(thread);
+
+ // Close all threads that are using the FilesetCatalogOperations class
loader
+ if (runningWithCurrentClassLoader(thread)) {
+ LOG.info("Interrupting peer cache thread: {}", thread.getName());
+ thread.setContextClassLoader(null);
+ thread.interrupt();
+ try {
+ thread.join(5000);
+ } catch (InterruptedException e) {
+ LOG.warn("Failed to join peer cache thread: {}", thread.getName(),
e);
+ }
+ }
+ }
+
+ // Release the LogFactory for the FilesetCatalogOperations class loader
+
LogFactory.release(SecureFilesetCatalogOperations.class.getClassLoader());
+
+ // For Aws SDK metrics, unregister the metric admin MBean
+ try {
Review Comment:
done
--
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]