don't cache classloaders which can be skipped by name (DataDog/dd-trace-java#1732)
MODIFY
javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/ClassLoaderMatcher.java
javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/ClassLoaderMatcher.java
@@ -67,6 +67,9 @@ public final class ClassLoaderMatcher {
// Don't skip bootstrap loader
return false;
}
+ if (canSkipClassLoaderByName(cl)) {
+ return true;
+ }
Boolean v = skipCache.getIfPresent(cl);
if (v != null) {
return v;
@@ -79,12 +82,12 @@ public final class ClassLoaderMatcher {
// and we don't want to introduce the concept of the tooling code depending on whether or not
// a particular instrumentation is active (mainly because this particular use case doesn't
// seem to justify introducing either of these new concepts)
- v = shouldSkipClass(cl) || !delegatesToBootstrap(cl);
+ v = !delegatesToBootstrap(cl);
skipCache.put(cl, v);
return v;
}
- private static boolean shouldSkipClass(ClassLoader loader) {
+ private static boolean canSkipClassLoaderByName(ClassLoader loader) {
switch (loader.getClass().getName()) {
case "org.codehaus.groovy.runtime.callsite.CallSiteClassLoader":
case "sun.reflect.DelegatingClassLoader":

don't cache classloaders which can be skipped by name (DataDog/dd-trace-java#1732)