Package org.apache.flink.util
Class ChildFirstClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- java.security.SecureClassLoader
-
- java.net.URLClassLoader
-
- org.apache.flink.util.MutableURLClassLoader
-
- org.apache.flink.util.FlinkUserCodeClassLoader
-
- org.apache.flink.util.ChildFirstClassLoader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public final class ChildFirstClassLoader extends FlinkUserCodeClassLoader
A variant of the URLClassLoader that first loads from the URLs and only after that from the parent.URLClassLoader.getResourceAsStream(String)
usesgetResource(String)
internally so we don't override that.
-
-
Field Summary
-
Fields inherited from class org.apache.flink.util.FlinkUserCodeClassLoader
classLoadingExceptionHandler, NOOP_EXCEPTION_HANDLER
-
-
Constructor Summary
Constructors Constructor Description ChildFirstClassLoader(URL[] urls, ClassLoader parent, String[] alwaysParentFirstPatterns, Consumer<Throwable> classLoadingExceptionHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MutableURLClassLoader
copy()
Copy the classloader for each job and these jobs can add their jar files to the classloader independently.URL
getResource(String name)
Enumeration<URL>
getResources(String name)
protected Class<?>
loadClassWithoutExceptionHandling(String name, boolean resolve)
Same asFlinkUserCodeClassLoader.loadClass(String, boolean)
but without exception handling.-
Methods inherited from class org.apache.flink.util.FlinkUserCodeClassLoader
loadClass
-
Methods inherited from class org.apache.flink.util.MutableURLClassLoader
addURL
-
Methods inherited from class java.net.URLClassLoader
close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
-
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Constructor Detail
-
ChildFirstClassLoader
public ChildFirstClassLoader(URL[] urls, ClassLoader parent, String[] alwaysParentFirstPatterns, Consumer<Throwable> classLoadingExceptionHandler)
-
-
Method Detail
-
loadClassWithoutExceptionHandling
protected Class<?> loadClassWithoutExceptionHandling(String name, boolean resolve) throws ClassNotFoundException
Description copied from class:FlinkUserCodeClassLoader
Same asFlinkUserCodeClassLoader.loadClass(String, boolean)
but without exception handling.Extending concrete class loaders should implement this instead of
FlinkUserCodeClassLoader.loadClass(String, boolean)
.- Overrides:
loadClassWithoutExceptionHandling
in classFlinkUserCodeClassLoader
- Throws:
ClassNotFoundException
-
getResource
public URL getResource(String name)
- Overrides:
getResource
in classClassLoader
-
getResources
public Enumeration<URL> getResources(String name) throws IOException
- Overrides:
getResources
in classClassLoader
- Throws:
IOException
-
copy
public MutableURLClassLoader copy()
Description copied from class:MutableURLClassLoader
Copy the classloader for each job and these jobs can add their jar files to the classloader independently.- Specified by:
copy
in classMutableURLClassLoader
- Returns:
- the copied classloader
-
-