use of com.navercorp.pinpoint.bootstrap.interceptor.Interceptor in project pinpoint by naver.
the class JavassistMethod method addInterceptor0.
private int addInterceptor0(String interceptorClassName, Object[] constructorArgs, InterceptorScope scope, ExecutionPolicy executionPolicy) throws InstrumentException {
try {
ScopeInfo scopeInfo = resolveScopeInfo(interceptorClassName, scope, executionPolicy);
Interceptor interceptor = createInterceptor(interceptorClassName, scopeInfo, constructorArgs);
int interceptorId = interceptorRegistryBinder.getInterceptorRegistryAdaptor().addInterceptor(interceptor);
addInterceptor0(interceptor, interceptorId);
return interceptorId;
} catch (CannotCompileException ccex) {
throw new InstrumentException("Failed to add interceptor " + interceptorClassName + " to " + behavior.getLongName(), ccex);
} catch (NotFoundException nex) {
throw new InstrumentException("Failed to add interceptor " + interceptorClassName + " to " + behavior.getLongName(), nex);
}
}
use of com.navercorp.pinpoint.bootstrap.interceptor.Interceptor in project pinpoint by naver.
the class AnnotatedInterceptorFactoryTest method test6.
@Test
public void test6() throws Exception {
Object[] args = new Object[] { (float) 3.0, (short) 2, (byte) 1, "arg0" };
AnnotatedInterceptorFactory factory = newAnnotatedInterceptorFactory();
Interceptor interceptor = factory.getInterceptor(getClass().getClassLoader(), TestInterceptor1.class.getName(), args, null, null, instrumentClass, instrumentMethod);
assertEquals(TestInterceptor1.class, interceptor.getClass());
assertEquals(args[3], getField(interceptor, "field0"));
assertEquals(args[2], getField(interceptor, "field1"));
assertEquals(args[1], getField(interceptor, "field2"));
assertEquals(args[0], getField(interceptor, "field3"));
}
use of com.navercorp.pinpoint.bootstrap.interceptor.Interceptor in project pinpoint by naver.
the class AnnotatedInterceptorFactoryTest method test10.
@Test
public void test10() throws Exception {
Object[] args = new Object[] { "arg0", 1, 2.0 };
AnnotatedInterceptorFactory factory = newAnnotatedInterceptorFactory();
Interceptor interceptor = factory.getInterceptor(getClass().getClassLoader(), TestInterceptor2.class.getName(), args, null, null, instrumentClass, instrumentMethod);
assertEquals(TestInterceptor2.class, interceptor.getClass());
assertEquals(args[0], getField(interceptor, "field0"));
assertEquals(args[1], getField(interceptor, "field1"));
assertEquals(args[2], getField(interceptor, "field2"));
assertEquals(false, getField(interceptor, "field3"));
assertEquals(0L, getField(interceptor, "field4"));
assertSame(descriptor, getField(interceptor, "descriptor"));
assertSame(instrumentClass, getField(interceptor, "targetClass"));
assertSame(instrumentMethod, getField(interceptor, "targetMethod"));
}
use of com.navercorp.pinpoint.bootstrap.interceptor.Interceptor in project pinpoint by naver.
the class AnnotatedInterceptorFactoryTest method test1.
@Test
public void test1() throws Exception {
Object[] args = new Object[] { "arg0" };
AnnotatedInterceptorFactory factory = newAnnotatedInterceptorFactory();
Interceptor interceptor = factory.getInterceptor(getClass().getClassLoader(), TestInterceptor0.class.getName(), args, null, null, instrumentClass, instrumentMethod);
assertEquals(TestInterceptor0.class, interceptor.getClass());
assertEquals(args[0], getField(interceptor, "field0"));
}
use of com.navercorp.pinpoint.bootstrap.interceptor.Interceptor in project pinpoint by naver.
the class AnnotatedInterceptorFactoryTest method test5.
@Test
public void test5() throws Exception {
Object[] args = new Object[] { (short) 2, (float) 3.0, "arg0", (byte) 1 };
AnnotatedInterceptorFactory factory = newAnnotatedInterceptorFactory();
Interceptor interceptor = factory.getInterceptor(getClass().getClassLoader(), TestInterceptor1.class.getName(), args, null, null, instrumentClass, instrumentMethod);
assertEquals(TestInterceptor1.class, interceptor.getClass());
assertEquals(args[2], getField(interceptor, "field0"));
assertEquals(args[3], getField(interceptor, "field1"));
assertEquals(args[0], getField(interceptor, "field2"));
assertEquals(args[1], getField(interceptor, "field3"));
}
Aggregations