Class InstrumentationModuleClassLoader
java.lang.Object
java.lang.ClassLoader
io.opentelemetry.javaagent.tooling.instrumentation.indy.InstrumentationModuleClassLoader
Classloader used to load the helper classes from
InstrumentationModules, so that those
classes have access to both the agent/extension classes and the instrumented application classes.
This classloader implements the following classloading delegation strategy:
- First, injected classes are considered (usually the helper classes from the InstrumentationModule)
- Next, the classloader looks in the agent or extension classloader, depending on where the InstrumentationModule comes from
- Finally, the instrumented application classloader is checked for the class
In addition, this classloader ensures that the lookup of corresponding .class resources follow the same delegation strategy, so that bytecode inspection tools work correctly.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInstrumentationModuleClassLoader(ClassLoader instrumentedCl, ClassLoader agentOrExtensionCl, Map<String, io.opentelemetry.javaagent.tooling.BytecodeWithUrl> injectedClasses) -
Method Summary
Modifier and TypeMethodDescriptionProvides a Lookup within this classloader.getResource(String resourceName) getResources(String resourceName) protected Class<?>Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResourceAsStream, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Field Details
-
bytecodeOverride
-
-
Constructor Details
-
InstrumentationModuleClassLoader
public InstrumentationModuleClassLoader(ClassLoader instrumentedCl, ClassLoader agentOrExtensionCl, Map<String, io.opentelemetry.javaagent.tooling.BytecodeWithUrl> injectedClasses)
-
-
Method Details
-
getLookup
Provides a Lookup within this classloader. SeeLookupExposerfor the details.- Returns:
- a lookup capable of accessing public types in this classloader
-
loadClass
- Overrides:
loadClassin classClassLoader- Throws:
ClassNotFoundException
-
getResource
- Overrides:
getResourcein classClassLoader
-
getResources
- Overrides:
getResourcesin classClassLoader- Throws:
IOException
-