public static MutableURLClassLoader childFirst(
            URL[] urls,
            ClassLoader parent,
            String[] alwaysParentFirstPatterns,
            Consumer<Throwable> classLoadingExceptionHandler,
            boolean checkClassLoaderLeak) {
        FlinkUserCodeClassLoader classLoader =
                new ChildFirstClassLoader(
                        urls, parent, alwaysParentFirstPatterns, classLoadingExceptionHandler);
        return wrapWithSafetyNet(classLoader, checkClassLoaderLeak);
    }
@Test
    void testRepeatedParentFirstPatternClass() throws Exception {
        final String className = FlinkUserCodeClassLoadersTest.class.getName();
        final String parentFirstPattern = className.substring(0, className.lastIndexOf('.'));

        final ClassLoader parentClassLoader = getClass().getClassLoader();

        // collect the libraries / class folders with RocksDB related code: the state backend and
        // RocksDB itself
        final URL childCodePath = getClass().getProtectionDomain().getCodeSource().getLocation();

        final URLClassLoader childClassLoader =
                FlinkUserCodeClassLoaders.childFirst(
                        new URL[] {childCodePath},
                        parentClassLoader,
                        new String[] {parentFirstPattern},
                        NOOP_EXCEPTION_HANDLER,
                        true);

        final Class<?> clazz1 = Class.forName(className, false, parentClassLoader);
        final Class<?> clazz2 = Class.forName(className, false, childClassLoader);
        final Class<?> clazz3 = Class.forName(className, false, childClassLoader);
        final Class<?> clazz4 = Class.forName(className, false, childClassLoader);

        assertThat(clazz2).isEqualTo(clazz1);
        assertThat(clazz3).isEqualTo(clazz1);
        assertThat(clazz4).isEqualTo(clazz1);

        childClassLoader.close();
    }