use of com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScope in project pinpoint by naver.
the class JavassistMethod method addScopedInterceptor.
@Override
public int addScopedInterceptor(String interceptorClassName, Object[] constructorArgs, String scopeName, ExecutionPolicy executionPolicy) throws InstrumentException {
Asserts.notNull(interceptorClassName, "interceptorClassName");
Asserts.notNull(constructorArgs, "constructorArgs");
Asserts.notNull(scopeName, "scopeName");
Asserts.notNull(executionPolicy, "executionPolicy");
final InterceptorScope interceptorScope = this.pluginContext.getInterceptorScope(scopeName);
return addInterceptor0(interceptorClassName, constructorArgs, interceptorScope, executionPolicy);
}
use of com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScope 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);
}
use of com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScope in project pinpoint by naver.
the class JavassistMethod method addScopedInterceptor.
@Override
public int addScopedInterceptor(String interceptorClassName, String scopeName) throws InstrumentException {
Asserts.notNull(interceptorClassName, "interceptorClassName");
Asserts.notNull(scopeName, "scopeName");
final InterceptorScope interceptorScope = this.pluginContext.getInterceptorScope(scopeName);
return addInterceptor0(interceptorClassName, null, interceptorScope, null);
}
use of com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScope in project pinpoint by naver.
the class ConcurrentPoolTest method testConcurrentPool.
@Test
public void testConcurrentPool() throws Exception {
InterceptorScopeFactory traceScopeFactory = new InterceptorScopeFactory();
Pool<String, InterceptorScope> pool = new ConcurrentPool<String, InterceptorScope>(traceScopeFactory);
final String OBJECT_NAME = "test";
InterceptorScope addedScope = pool.get(OBJECT_NAME);
Assert.assertSame(pool.get(OBJECT_NAME), addedScope);
InterceptorScope exist = pool.get(OBJECT_NAME);
Assert.assertSame(exist, addedScope);
InterceptorScope another = pool.get("another");
Assert.assertNotSame(exist, another);
}
Aggregations