paul8263 commented on a change in pull request #15927:
URL: https://github.com/apache/flink/pull/15927#discussion_r638417597
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/execution/librarycache/FlinkUserCodeClassLoadersTest.java
##########
@@ -208,6 +212,50 @@ public void testRepeatedParentFirstPatternClass() throws
Exception {
childClassLoader.close();
}
+ @Test
+ public void testGetClassLoaderInfo() throws Exception {
+ final ClassLoader parentClassLoader = getClass().getClassLoader();
+
+ final URL childCodePath =
getClass().getProtectionDomain().getCodeSource().getLocation();
+
+ final URLClassLoader childClassLoader =
+ FlinkUserCodeClassLoaders.childFirst(
+ new URL[] {childCodePath},
+ parentClassLoader,
+ new String[] {},
+ NOOP_EXCEPTION_HANDLER,
+ true);
+
+ String formattedURL = ClassLoaderUtil.formatURL(childCodePath);
+
+ assertEquals(
+ ClassLoaderUtil.getUserCodeClassLoaderInfo(childClassLoader),
+ "URL ClassLoader:" + formattedURL);
+
+ childClassLoader.close();
+ }
+
+ @Test
+ public void testGetClassLoaderInfoWithClassLoaderClosed() throws Exception
{
+ final ClassLoader parentClassLoader = getClass().getClassLoader();
+
+ final URL childCodePath =
getClass().getProtectionDomain().getCodeSource().getLocation();
+
+ final URLClassLoader childClassLoader =
+ FlinkUserCodeClassLoaders.childFirst(
+ new URL[] {childCodePath},
+ parentClassLoader,
+ new String[] {},
+ NOOP_EXCEPTION_HANDLER,
+ true);
+
+ childClassLoader.close();
+
+ assertThat(
+ ClassLoaderUtil.getUserCodeClassLoaderInfo(childClassLoader),
+ is(startsWith("Cannot access classloader info due to an
exception.")));
Review comment:
It was fixed in c927703
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]