Rename TypeInstrumentation#classLoaderMatcher() to classLoaderOptimization() (#1741)
* Rename TypeInstrumentation#classLoaderMatcher() to classLoaderOptimization() * Removed no longer needed comments & improved JavaDoc * Improve TypeInstrumentation Javadoc
This commit is contained in:
parent
7e8d549347
commit
45646ff367
|
@ -38,8 +38,7 @@ final class AkkaForkJoinTaskInstrumentation implements TypeInstrumentation {
|
|||
static final String TASK_CLASS_NAME = "akka.dispatch.forkjoin.ForkJoinTask";
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed(TASK_CLASS_NAME);
|
||||
}
|
||||
|
||||
|
|
|
@ -67,8 +67,7 @@ public class ApacheCamelInstrumentationModule extends InstrumentationModule {
|
|||
|
||||
private static final class CamelContextInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.apache.camel.CamelContext");
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@ import org.apache.http.protocol.HttpCoreContext;
|
|||
final class ApacheHttpAsyncClientInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.apache.http.nio.client.HttpAsyncClient");
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,7 @@ import org.apache.http.HttpRequest;
|
|||
public class ApacheHttpClientRedirectInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.apache.http.client.RedirectStrategy");
|
||||
}
|
||||
|
||||
|
|
|
@ -50,8 +50,7 @@ public class ApacheHttpClientInstrumentationModule extends InstrumentationModule
|
|||
|
||||
private static final class HttpClientInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.apache.commons.httpclient.HttpClient");
|
||||
}
|
||||
|
||||
|
|
|
@ -59,8 +59,7 @@ public class ApacheHttpClientInstrumentationModule extends InstrumentationModule
|
|||
|
||||
private static final class HttpClientInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.apache.http.client.HttpClient");
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class ResponseInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("com.ning.http.client.AsyncCompletionHandler");
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class AwsLambdaRequestHandlerInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("com.amazonaws.services.lambda.runtime.RequestHandler");
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class RequestInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("com.amazonaws.AmazonWebServiceRequest");
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,7 @@ import software.amazon.awssdk.core.internal.http.pipeline.stages.MakeAsyncHttpRe
|
|||
final class AwsHttpClientInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed(
|
||||
"software.amazon.awssdk.core.internal.http.pipeline.stages.MakeHttpRequestStage");
|
||||
}
|
||||
|
|
|
@ -30,8 +30,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class CouchbaseNetworkInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("com.couchbase.client.core.endpoint.AbstractGenericHandler");
|
||||
}
|
||||
|
||||
|
|
|
@ -47,8 +47,7 @@ public final class DropwizardViewsInstrumentationModule extends InstrumentationM
|
|||
|
||||
private static final class ViewRendererInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("io.dropwizard.views.ViewRenderer");
|
||||
}
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ public final class TraceAnnotationsInstrumentationModule extends Instrumentation
|
|||
|
||||
private static final class AnnotatedMethodsInstrumentation implements TypeInstrumentation {
|
||||
private final Set<String> additionalTraceAnnotations;
|
||||
private final ElementMatcher.Junction<ClassLoader> classLoaderOptimization;
|
||||
private final ElementMatcher.Junction<NamedElement> traceAnnotationMatcher;
|
||||
/** This matcher matches all methods that should be excluded from transformation. */
|
||||
private final ElementMatcher.Junction<MethodDescription> excludedMethodsMatcher;
|
||||
|
@ -92,16 +93,21 @@ public final class TraceAnnotationsInstrumentationModule extends Instrumentation
|
|||
additionalTraceAnnotations = configureAdditionalTraceAnnotations();
|
||||
|
||||
if (additionalTraceAnnotations.isEmpty()) {
|
||||
classLoaderOptimization = none();
|
||||
traceAnnotationMatcher = none();
|
||||
} else {
|
||||
ElementMatcher.Junction<ClassLoader> classLoaderMatcher = null;
|
||||
ElementMatcher.Junction<NamedElement> methodTraceMatcher = null;
|
||||
for (String annotationName : additionalTraceAnnotations) {
|
||||
if (methodTraceMatcher == null) {
|
||||
classLoaderMatcher = hasClassesNamed(annotationName);
|
||||
methodTraceMatcher = named(annotationName);
|
||||
} else {
|
||||
classLoaderMatcher = classLoaderMatcher.or(hasClassesNamed(annotationName));
|
||||
methodTraceMatcher = methodTraceMatcher.or(named(annotationName));
|
||||
}
|
||||
}
|
||||
this.classLoaderOptimization = classLoaderMatcher;
|
||||
this.traceAnnotationMatcher = methodTraceMatcher;
|
||||
}
|
||||
|
||||
|
@ -109,20 +115,8 @@ public final class TraceAnnotationsInstrumentationModule extends Instrumentation
|
|||
}
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
ElementMatcher.Junction<ClassLoader> matcher = null;
|
||||
for (String name : additionalTraceAnnotations) {
|
||||
if (matcher == null) {
|
||||
matcher = hasClassesNamed(name);
|
||||
} else {
|
||||
matcher = matcher.or(hasClassesNamed(name));
|
||||
}
|
||||
}
|
||||
if (matcher == null) {
|
||||
return none();
|
||||
}
|
||||
return matcher;
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return classLoaderOptimization;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -86,8 +86,7 @@ public class TraceConfigInstrumentationModule extends InstrumentationModule {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed(className);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,7 @@ public class FinatraInstrumentationModule extends InstrumentationModule {
|
|||
|
||||
private static final class RouteInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("com.twitter.finatra.http.internal.routing.Route");
|
||||
}
|
||||
|
||||
|
|
|
@ -50,8 +50,7 @@ public class GeodeInstrumentationModule extends InstrumentationModule {
|
|||
|
||||
private static final class RegionInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// optimization for expensive typeMatcher
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.apache.geode.cache.Region");
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.bytebuddy.matcher.ElementMatchers;
|
|||
final class FilterInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.glassfish.grizzly.filterchain.BaseFilter");
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
|
||||
final class GrpcClientBuilderBuildInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// optimization for expensive typeMatcher
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("io.grpc.ManagedChannelBuilder");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ import org.hibernate.Criteria;
|
|||
final class CriteriaInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.hibernate.Criteria");
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,7 @@ import org.hibernate.Query;
|
|||
final class QueryInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.hibernate.Query");
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,7 @@ import org.hibernate.StatelessSession;
|
|||
final class SessionFactoryInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.hibernate.SessionFactory");
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@ import org.hibernate.Transaction;
|
|||
final class SessionInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.hibernate.Session", "org.hibernate.StatelessSession");
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,7 @@ import org.hibernate.Transaction;
|
|||
final class TransactionInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.hibernate.Transaction");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ import org.hibernate.Criteria;
|
|||
final class CriteriaInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.hibernate.Criteria");
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,7 @@ import org.hibernate.Query;
|
|||
final class QueryInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.hibernate.Query");
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,7 @@ import org.hibernate.SharedSessionContract;
|
|||
final class SessionFactoryInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.hibernate.SessionFactory");
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,7 @@ import org.hibernate.Transaction;
|
|||
final class SessionInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.hibernate.SharedSessionContract");
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,7 @@ import org.hibernate.Transaction;
|
|||
final class TransactionInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.hibernate.Transaction");
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ import org.hibernate.procedure.ProcedureCall;
|
|||
final class ProcedureCallInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.hibernate.procedure.ProcedureCall");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ import org.hibernate.procedure.ProcedureCall;
|
|||
final class SessionInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.hibernate.SharedSessionContract");
|
||||
}
|
||||
|
||||
|
|
|
@ -57,8 +57,7 @@ public class HystrixInstrumentationModule extends InstrumentationModule {
|
|||
|
||||
private static final class HystrixCommandInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed(
|
||||
"com.netflix.hystrix.HystrixCommand", "com.netflix.hystrix.HystrixObservableCommand");
|
||||
}
|
||||
|
|
|
@ -33,8 +33,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class HttpClientInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("java.net.http.HttpClient");
|
||||
}
|
||||
|
||||
|
|
|
@ -52,8 +52,7 @@ public final class JaxRsClientInstrumentationModule extends InstrumentationModul
|
|||
|
||||
private static final class ClientHandlerInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("com.sun.jersey.api.client.ClientHandler");
|
||||
}
|
||||
|
||||
|
|
|
@ -49,8 +49,7 @@ public final class JaxRsClientInstrumentationModule extends InstrumentationModul
|
|||
|
||||
private static final class ClientBuilderInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.ws.rs.client.ClientBuilder");
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class JaxRsAnnotationsInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.ws.rs.Path");
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
|
||||
public abstract class AbstractRequestContextInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.ws.rs.container.ContainerRequestContext");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
class ContainerRequestFilterInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.ws.rs.container.ContainerRequestFilter");
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
|
||||
final class JaxRsAnnotationsInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.ws.rs.Path");
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class JaxRsAsyncResponseInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.ws.rs.container.AsyncResponse");
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class ConnectionInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("java.sql.Connection");
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class DriverInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("java.sql.Driver");
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class PreparedStatementInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("java.sql.PreparedStatement");
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class StatementInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("java.sql.Statement");
|
||||
}
|
||||
|
||||
|
|
|
@ -50,8 +50,7 @@ public final class JettyInstrumentationModule extends InstrumentationModule {
|
|||
|
||||
private static final class HandlerInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.eclipse.jetty.server.Handler");
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class JmsMessageConsumerInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.jms.MessageConsumer");
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class JmsMessageListenerInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.jms.MessageListener");
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class JmsMessageProducerInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.jms.MessageProducer");
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class JmsSessionInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.jms.Session");
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class HttpJspPageInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.servlet.jsp.HttpJspPage");
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class KHttpInstrumentationModule extends InstrumentationModule {
|
|||
|
||||
private static final class KHttpInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("khttp.KHttp");
|
||||
}
|
||||
|
||||
|
|
|
@ -51,8 +51,7 @@ public class KubernetesClientInstrumentationModule extends InstrumentationModule
|
|||
|
||||
private static final class ApiClientInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("io.kubernetes.client.openapi.ApiClient");
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,7 @@ import org.jboss.netty.channel.ChannelFuture;
|
|||
final class ChannelFutureListenerInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.jboss.netty.channel.ChannelFutureListener");
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,7 @@ import org.jboss.netty.channel.Channel;
|
|||
final class NettyChannelInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.jboss.netty.channel.Channel");
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@ import org.jboss.netty.handler.codec.http.HttpServerCodec;
|
|||
final class NettyChannelPipelineInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.jboss.netty.channel.ChannelPipeline");
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class ChannelFutureListenerInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("io.netty.channel.ChannelFutureListener");
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class NettyChannelPipelineInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("io.netty.channel.ChannelPipeline");
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class ChannelFutureListenerInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("io.netty.channel.ChannelFutureListener");
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class NettyChannelPipelineInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("io.netty.channel.ChannelPipeline");
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class OshiInstrumentationModule extends InstrumentationModule {
|
|||
|
||||
private static final class SystemInfoInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("oshi.SystemInfo");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ public class AsyncHttpClientInstrumentation implements TypeInstrumentation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("play.shaded.ahc.org.asynchttpclient.AsyncHttpClient");
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@ public final class PlayInstrumentationModule extends InstrumentationModule {
|
|||
|
||||
private static final class ActionInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("play.api.mvc.Action");
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@ public final class PlayInstrumentationModule extends InstrumentationModule {
|
|||
|
||||
private static final class ActionInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("play.api.mvc.Action");
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@ public final class PlayInstrumentationModule extends InstrumentationModule {
|
|||
|
||||
private static final class ActionInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("play.api.mvc.Action");
|
||||
}
|
||||
|
||||
|
|
|
@ -45,8 +45,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class RabbitChannelInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("com.rabbitmq.client.Channel");
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class RabbitCommandInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("com.rabbitmq.client.Command");
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,7 @@ import ratpack.func.Block;
|
|||
final class ContinuationInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("ratpack.exec.internal.Continuation");
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class ServerErrorHandlerInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("ratpack.error.ServerErrorHandler");
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public final class RediscalaInstrumentationModule extends InstrumentationModule
|
|||
|
||||
private static final class RequestInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("redis.Request");
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,7 @@ final class ScalaForkJoinTaskInstrumentation implements TypeInstrumentation {
|
|||
static final String TASK_CLASS_NAME = "scala.concurrent.forkjoin.ForkJoinTask";
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed(TASK_CLASS_NAME);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
*/
|
||||
final class HttpServletResponseInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.servlet.http.HttpServletResponse");
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class ServletAndFilterInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.servlet.http.HttpServlet");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class AsyncContextInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.servlet.AsyncContext");
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
|
||||
final class ServletAndFilterInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.servlet.Filter");
|
||||
}
|
||||
|
||||
|
|
|
@ -60,8 +60,7 @@ public final class RequestDispatcherInstrumentationModule extends Instrumentatio
|
|||
|
||||
private static final class RequestDispatcherInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.servlet.RequestDispatcher");
|
||||
}
|
||||
|
||||
|
|
|
@ -50,8 +50,7 @@ public final class HttpServletResponseInstrumentationModule extends Instrumentat
|
|||
|
||||
private static final class HttpServletResponseInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("javax.servlet.http.HttpServletResponse");
|
||||
}
|
||||
|
||||
|
|
|
@ -47,8 +47,7 @@ public class WebfluxClientInstrumentationModule extends InstrumentationModule {
|
|||
|
||||
private static final class WebClientBuilderInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.springframework.web.reactive.function.client.WebClient");
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class HandlerAdapterInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.springframework.web.reactive.HandlerAdapter");
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class RouterFunctionInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.springframework.web.reactive.function.server.ServerRequest");
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class HandlerAdapterInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("org.springframework.web.servlet.HandlerAdapter");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
|||
final class WebApplicationContextInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed(
|
||||
"org.springframework.context.support.AbstractApplicationContext",
|
||||
"org.springframework.web.context.WebApplicationContext");
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
public class ActionInvocationInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("com.opensymphony.xwork2.ActionInvocation");
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class TwilioAsyncInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("com.twilio.Twilio");
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
final class TwilioSyncInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
// Optimization for expensive typeMatcher.
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("com.twilio.Twilio");
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class VertxRxInstrumentationModule extends InstrumentationModule {
|
|||
|
||||
private static final class AsyncResultSingleInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
// Different versions of Vert.x has this class in different packages
|
||||
return hasClassesNamed("io.vertx.reactivex.core.impl.AsyncResultSingle")
|
||||
.or(hasClassesNamed("io.vertx.reactivex.impl.AsyncResultSingle"));
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class VertxWebInstrumentationModule extends InstrumentationModule {
|
|||
|
||||
private static final class RouteInstrumentation implements TypeInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
public ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return hasClassesNamed("io.vertx.ext.web.Route");
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ public abstract class InstrumentationModule {
|
|||
typeInstrumentation.typeMatcher(),
|
||||
"Instrumentation type matcher unexpected exception: " + getClass().getName()),
|
||||
failSafe(
|
||||
moduleClassLoaderMatcher.and(typeInstrumentation.classLoaderMatcher()),
|
||||
moduleClassLoaderMatcher.and(typeInstrumentation.classLoaderOptimization()),
|
||||
"Instrumentation class loader matcher unexpected exception: "
|
||||
+ getClass().getName()))
|
||||
.and(NOT_DECORATOR_MATCHER)
|
||||
|
|
|
@ -12,20 +12,36 @@ import java.util.Map;
|
|||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import net.bytebuddy.matcher.ElementMatchers;
|
||||
|
||||
/**
|
||||
* Interface representing a single type instrumentation. Part of an {@link InstrumentationModule}.
|
||||
*/
|
||||
public interface TypeInstrumentation {
|
||||
/**
|
||||
* A type instrumentation can implement this method to optimize an expensive {@link
|
||||
* #typeMatcher()} - usually {@link AgentElementMatchers#implementsInterface(ElementMatcher)} or
|
||||
* {@link AgentElementMatchers#extendsClass(ElementMatcher)}. In that case it's useful to check
|
||||
* that the classloader contains the class/interface that is being extended.
|
||||
* An optimization to short circuit matching in the case where the instrumented library is not
|
||||
* even present on the class path.
|
||||
*
|
||||
* @return A type matcher used to match the classloader under transform
|
||||
* <p>Most applications have only a small subset of libraries on their class path, so this ends up
|
||||
* being a very useful optimization.
|
||||
*
|
||||
* <p>Some background on type matcher performance:
|
||||
*
|
||||
* <p>Type matchers that only match against the type name are fast, e.g. {@link
|
||||
* ElementMatchers#named(String)}.
|
||||
*
|
||||
* <p>All other type matchers require some level of bytecode inspection, e.g. {@link
|
||||
* ElementMatchers#isAnnotatedWith(ElementMatcher)}.
|
||||
*
|
||||
* <p>Type matchers that need to inspect the super class hierarchy are even more expensive, e.g.
|
||||
* {@link AgentElementMatchers#implementsInterface(ElementMatcher)}. This is because they require
|
||||
* inspecting multiple super classes/interfaces as well (which may not even be loaded yet in which
|
||||
* case their bytecode has to be read and inspected).
|
||||
*
|
||||
* @return A type matcher that rejects classloaders that do not contain desired interfaces or base
|
||||
* classes.
|
||||
*/
|
||||
default ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
default ElementMatcher<ClassLoader> classLoaderOptimization() {
|
||||
return any();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue