use of com.navercorp.pinpoint.bootstrap.interceptor.annotation.Scope in project pinpoint by naver.
the class ASMMethod method resolveScopeInfo.
private ScopeInfo resolveScopeInfo(String interceptorClassName, InterceptorScope scope, ExecutionPolicy policy) {
final Class<? extends Interceptor> interceptorType = this.pluginContext.injectClass(this.declaringClass.getClassLoader(), interceptorClassName);
if (scope == null) {
Scope interceptorScope = interceptorType.getAnnotation(Scope.class);
if (interceptorScope != null) {
String scopeName = interceptorScope.value();
scope = this.pluginContext.getInterceptorScope(scopeName);
policy = interceptorScope.executionPolicy();
}
}
if (scope == null) {
policy = null;
} else if (policy == null) {
policy = ExecutionPolicy.BOUNDARY;
}
return new ScopeInfo(scope, policy);
}
use of com.navercorp.pinpoint.bootstrap.interceptor.annotation.Scope in project pinpoint by naver.
the class AnnotatedInterceptorFactory method getInterceptor.
@Override
public Interceptor getInterceptor(ClassLoader classLoader, String interceptorClassName, Object[] providedArguments, InterceptorScope scope, ExecutionPolicy policy, InstrumentClass target, InstrumentMethod targetMethod) {
Class<? extends Interceptor> interceptorType = pluginContext.injectClass(classLoader, interceptorClassName);
if (scope == null) {
Scope interceptorScope = interceptorType.getAnnotation(Scope.class);
if (interceptorScope != null) {
String scopeName = interceptorScope.value();
scope = pluginContext.getInterceptorScope(scopeName);
policy = interceptorScope.executionPolicy();
}
}
AutoBindingObjectFactory factory = new AutoBindingObjectFactory(profilerConfig, traceContext, pluginContext, classLoader);
ObjectFactory objectFactory = ObjectFactory.byConstructor(interceptorClassName, providedArguments);
InterceptorArgumentProvider interceptorArgumentProvider = new InterceptorArgumentProvider(dataSourceMonitorRegistry, apiMetaDataService, scope, target, targetMethod);
Interceptor interceptor = (Interceptor) factory.createInstance(objectFactory, interceptorArgumentProvider);
if (scope != null) {
if (exceptionHandle) {
interceptor = wrapByExceptionHandleScope(interceptor, scope, policy == null ? ExecutionPolicy.BOUNDARY : policy);
} else {
interceptor = wrapByScope(interceptor, scope, policy == null ? ExecutionPolicy.BOUNDARY : policy);
}
} else {
if (exceptionHandle) {
interceptor = wrapByExceptionHandle(interceptor);
}
}
return interceptor;
}
use of com.navercorp.pinpoint.bootstrap.interceptor.annotation.Scope in project pinpoint by naver.
the class JavassistMethod method resolveScopeInfo.
private ScopeInfo resolveScopeInfo(String interceptorClassName, InterceptorScope scope, ExecutionPolicy policy) {
final Class<? extends Interceptor> interceptorType = pluginContext.injectClass(declaringClass.getClassLoader(), interceptorClassName);
if (scope == null) {
Scope interceptorScope = interceptorType.getAnnotation(Scope.class);
if (interceptorScope != null) {
String scopeName = interceptorScope.value();
scope = pluginContext.getInterceptorScope(scopeName);
policy = interceptorScope.executionPolicy();
}
}
if (scope == null) {
policy = null;
} else if (policy == null) {
policy = ExecutionPolicy.BOUNDARY;
}
return new ScopeInfo(scope, policy);
}
Aggregations