Package io.quarkus.bootstrap.runner
Class RunnerClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- io.quarkus.bootstrap.runner.RunnerClassLoader
-
public final class RunnerClassLoader extends ClassLoader
Classloader used with the fast-jar package type. This ClassLoader takes advantage of the fact that Quarkus knows the entire classpath when the application is built, and thus can index the location of classes and resources (with the result being written during the build to a binary file and read at application startup). The advantage this has over the JDK's default System ClassLoader is that it knows which jars contain the requested classes and resources and thus does not have to iterate over all the jars on the classpath (which is slow and takes up heap space as the jars need to be kept open), but instead can go directly to the jar(s) containing the requested class or resource. The implementation also contains optimizations that allow the ClassLoader to keep a minimum number of jars open while also preventing the lookup of the entire classpath for missing resources in known directories (like META-INF/services).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected Class<?>
findClass(String moduleName, String name)
This method is needed to make packages work correctly on JDK9+, as it will be called to load the package-info class.protected URL
findResource(String name)
protected Enumeration<URL>
findResources(String name)
Class<?>
loadClass(String name)
Class<?>
loadClass(String name, boolean resolve)
void
resetInternalCaches()
-
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, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Method Detail
-
loadClass
public Class<?> loadClass(String name) throws ClassNotFoundException
- Overrides:
loadClass
in classClassLoader
- Throws:
ClassNotFoundException
-
loadClass
public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
- Overrides:
loadClass
in classClassLoader
- Throws:
ClassNotFoundException
-
findResource
protected URL findResource(String name)
- Overrides:
findResource
in classClassLoader
-
findResources
protected Enumeration<URL> findResources(String name)
- Overrides:
findResources
in classClassLoader
-
findClass
protected Class<?> findClass(String moduleName, String name)
This method is needed to make packages work correctly on JDK9+, as it will be called to load the package-info class.- Overrides:
findClass
in classClassLoader
- Parameters:
moduleName
-name
-- Returns:
-
close
public void close()
-
resetInternalCaches
public void resetInternalCaches()
-
-