use of com.navercorp.pinpoint.profiler.objectfactory.ObjectBinderFactory in project pinpoint by naver.
the class ASMClass method addInterceptor0.
private int addInterceptor0(TargetFilter annotation, Class<? extends Interceptor> interceptorClass, InterceptorScope scope, ExecutionPolicy executionPolicy, Object[] constructorArgs) throws InstrumentException {
final String filterTypeName = annotation.type();
Objects.requireNonNull(filterTypeName, "type of @TargetFilter");
ObjectBinderFactory objectBinderFactory = engineComponent.getObjectBinderFactory();
final InterceptorArgumentProvider interceptorArgumentProvider = objectBinderFactory.newInterceptorArgumentProvider(this);
final AutoBindingObjectFactory filterFactory = objectBinderFactory.newAutoBindingObjectFactory(pluginContext, classNode.getClassLoader(), interceptorArgumentProvider);
final ObjectFactory objectFactory = ObjectFactory.byConstructor(filterTypeName, (Object[]) annotation.constructorArguments());
final MethodFilter filter = (MethodFilter) filterFactory.createInstance(objectFactory);
boolean singleton = annotation.singleton();
int interceptorId = -1;
for (InstrumentMethod m : getDeclaredMethods(filter)) {
if (singleton && interceptorId != -1) {
m.addInterceptor(interceptorId);
} else {
// TODO casting fix
interceptorId = ((ASMMethod) m).addInterceptorInternal(interceptorClass, constructorArgs, scope, executionPolicy);
}
}
if (interceptorId == -1) {
logger.warn("No methods are intercepted. target:{}, interceptor:{}, methodFilter:{} ", this.classNode.getInternalName(), interceptorClass, filterTypeName);
}
return interceptorId;
}
use of com.navercorp.pinpoint.profiler.objectfactory.ObjectBinderFactory in project pinpoint by naver.
the class ASMMethod method createInterceptor.
private Interceptor createInterceptor(Class<? extends Interceptor> interceptorClass, Object[] constructorArgs, ScopeInfo scopeInfo) {
// exception handling.
ObjectBinderFactory objectBinderFactory = this.engineComponent.getObjectBinderFactory();
final AnnotatedInterceptorFactory factory = objectBinderFactory.newAnnotatedInterceptorFactory(this.pluginContext);
final Interceptor interceptor = factory.newInterceptor(interceptorClass, constructorArgs, scopeInfo, this.declaringClass, this);
return interceptor;
}
use of com.navercorp.pinpoint.profiler.objectfactory.ObjectBinderFactory in project pinpoint by naver.
the class JavassistClassTest method newJavassistEngine.
private InstrumentEngine newJavassistEngine() {
Instrumentation instrumentation = mock(Instrumentation.class);
ObjectBinderFactory objectBinderFactory = mock(ObjectBinderFactory.class);
Provider<ApiMetaDataService> apiMetaDataService = Providers.of(mock(ApiMetaDataService.class));
return new JavassistEngine(instrumentation, objectBinderFactory, new GlobalInterceptorRegistryBinder(), apiMetaDataService, null);
}
use of com.navercorp.pinpoint.profiler.objectfactory.ObjectBinderFactory in project pinpoint by naver.
the class JavassistEngineTest method newJavassistEngine.
private InstrumentEngine newJavassistEngine() {
Instrumentation instrumentation = mock(Instrumentation.class);
ObjectBinderFactory objectBinderFactory = mock(ObjectBinderFactory.class);
Provider<ApiMetaDataService> apiMetaDataService = Providers.of(mock(ApiMetaDataService.class));
InterceptorRegistryBinder binder = new TestInterceptorRegistryBinder();
return new JavassistEngine(instrumentation, objectBinderFactory, binder, apiMetaDataService, null);
}
Aggregations