yuqi1129 commented on code in PR #11431:
URL: https://github.com/apache/gravitino/pull/11431#discussion_r3360269682
##########
catalogs/catalog-common/src/main/java/org/apache/gravitino/utils/ClassLoaderResourceCleanerUtils.java:
##########
@@ -301,6 +345,16 @@ private static void closeResourceInAzure(ClassLoader
classLoader) throws Excepti
MethodUtils.invokeStaticMethod(relocatedLogFactory, "release",
classLoader);
}
+ /**
+ * Returns true if {@code clazz} was loaded directly by {@code classLoader}
(not delegated to a
+ * parent). Use this before touching static fields that must belong to the
catalog's own
+ * classloader to avoid accidentally mutating JVM-global shared state.
+ */
+ @VisibleForTesting
+ static boolean isOwnedByClassLoader(Class<?> clazz, ClassLoader classLoader)
{
+ return clazz.getClassLoader() == classLoader;
+ }
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]