Class ComponentClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- java.security.SecureClassLoader
-
- java.net.URLClassLoader
-
- org.apache.flink.core.classloading.ComponentClassLoader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
SubmoduleClassLoader
public class ComponentClassLoader extends URLClassLoader
AURLClassLoader
that restricts which classes can be loaded to those contained within the given classpath, except classes from a given set of packages that are either loaded owner or component-first.Depiction of the class loader hierarchy:
Owner Bootstrap ^ ^ |---------| | Component
For loading classes/resources, class loaders are accessed in one of the following orders:
- component-only: component -> bootstrap; default.
- component-first: component -> bootstrap -> owner; opt-in.
- owner-first: owner -> component -> bootstrap; opt-in.
-
-
Constructor Summary
Constructors Constructor Description ComponentClassLoader(URL[] classpath, ClassLoader ownerClassLoader, String[] ownerFirstPackages, String[] componentFirstPackages, Map<String,String> knownPackagePrefixesModuleAssociation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description URL
getResource(String name)
InputStream
getResourceAsStream(String name)
Enumeration<URL>
getResources(String name)
protected Class<?>
loadClass(String name, boolean resolve)
-
Methods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, findResource, findResources, getPermissions, 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
-
-
-
-
Method Detail
-
loadClass
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
- Overrides:
loadClass
in classClassLoader
- Throws:
ClassNotFoundException
-
getResource
public URL getResource(String name)
- Overrides:
getResource
in classClassLoader
-
getResourceAsStream
public InputStream getResourceAsStream(String name)
- Overrides:
getResourceAsStream
in classURLClassLoader
-
getResources
public Enumeration<URL> getResources(String name) throws IOException
- Overrides:
getResources
in classClassLoader
- Throws:
IOException
-
-