Manual merge of tyler/classloader-precheck

This commit is contained in:
Laplie Anderson 2020-03-04 10:42:13 -05:00
parent 47fb25a8f8
commit d6638f4ff5
1 changed files with 8 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package datadog.trace.instrumentation.playws;
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasNoResources;
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.hasInterface;
import static java.util.Collections.singletonMap;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
@ -20,6 +21,13 @@ public abstract class BasePlayWSClientInstrumentation extends Instrumenter.Defau
super("play-ws");
}
@Override
public ElementMatcher<ClassLoader> classLoaderMatcher() {
// Optimization for expensive typeMatcher.
return not(
classLoaderHasNoResources("play/shaded/ahc/org/asynchttpclient/AsyncHttpClient.class"));
}
@Override
public ElementMatcher<? super TypeDescription> typeMatcher() {
// CachingAsyncHttpClient rejects overrides to AsyncHandler