Search in sources :

Example 1 with AnnotatedInterceptorFactory

use of com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory in project pinpoint by naver.

the class ASMMethod method createInterceptor.

private Interceptor createInterceptor(String interceptorClassName, ScopeInfo scopeInfo, Object[] constructorArgs) {
    final ClassLoader classLoader = this.declaringClass.getClassLoader();
    // exception handling.
    final AnnotatedInterceptorFactory factory = objectBinderFactory.newAnnotatedInterceptorFactory(this.pluginContext, true);
    final Interceptor interceptor = factory.getInterceptor(classLoader, interceptorClassName, constructorArgs, scopeInfo.getScope(), scopeInfo.getPolicy(), this.declaringClass, this);
    return interceptor;
}
Also used : Interceptor(com.navercorp.pinpoint.bootstrap.interceptor.Interceptor) AnnotatedInterceptorFactory(com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory)

Example 2 with AnnotatedInterceptorFactory

use of com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory in project pinpoint by naver.

the class ObjectBinderFactory method newAnnotatedInterceptorFactory.

public AnnotatedInterceptorFactory newAnnotatedInterceptorFactory(InstrumentContext pluginContext, boolean exceptionHandle) {
    final TraceContext traceContext = this.traceContextProvider.get();
    ApiMetaDataService apiMetaDataService = this.apiMetaDataServiceProvider.get();
    return new AnnotatedInterceptorFactory(profilerConfig, traceContext, dataSourceMonitorRegistry, apiMetaDataService, pluginContext, exceptionHandle);
}
Also used : TraceContext(com.navercorp.pinpoint.bootstrap.context.TraceContext) ApiMetaDataService(com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService) AnnotatedInterceptorFactory(com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory)

Example 3 with AnnotatedInterceptorFactory

use of com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory in project pinpoint by naver.

the class JavassistMethod method createInterceptor.

private Interceptor createInterceptor(String interceptorClassName, ScopeInfo scopeInfo, Object[] constructorArgs) {
    ClassLoader classLoader = declaringClass.getClassLoader();
    AnnotatedInterceptorFactory factory = objectBinderFactory.newAnnotatedInterceptorFactory(pluginContext, false);
    Interceptor interceptor = factory.getInterceptor(classLoader, interceptorClassName, constructorArgs, scopeInfo.getScope(), scopeInfo.getPolicy(), declaringClass, this);
    return interceptor;
}
Also used : Interceptor(com.navercorp.pinpoint.bootstrap.interceptor.Interceptor) AnnotatedInterceptorFactory(com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory)

Example 4 with AnnotatedInterceptorFactory

use of com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory in project pinpoint by naver.

the class AnnotatedInterceptorFactoryTest method test2.

@Test(expected = PinpointException.class)
public void test2() throws Exception {
    Object[] args = new Object[] { 1 };
    AnnotatedInterceptorFactory factory = newAnnotatedInterceptorFactory();
    factory.getInterceptor(getClass().getClassLoader(), TestInterceptor0.class.getName(), args, null, null, instrumentClass, instrumentMethod);
}
Also used : TestInterceptor0(com.navercorp.pinpoint.profiler.plugin.TestInterceptors.TestInterceptor0) AnnotatedInterceptorFactory(com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory) Test(org.junit.Test)

Example 5 with AnnotatedInterceptorFactory

use of com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory in project pinpoint by naver.

the class AnnotatedInterceptorFactoryTest method test4.

@Test
public void test4() throws Exception {
    Object[] args = new Object[] { (byte) 1, (short) 2, (float) 3.0, "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[0], getField(interceptor, "field1"));
    assertEquals(args[1], getField(interceptor, "field2"));
    assertEquals(args[2], getField(interceptor, "field3"));
}
Also used : TestInterceptor1(com.navercorp.pinpoint.profiler.plugin.TestInterceptors.TestInterceptor1) Interceptor(com.navercorp.pinpoint.bootstrap.interceptor.Interceptor) AnnotatedInterceptorFactory(com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory) Test(org.junit.Test)

Aggregations

AnnotatedInterceptorFactory (com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory)18 Test (org.junit.Test)15 Interceptor (com.navercorp.pinpoint.bootstrap.interceptor.Interceptor)14 TestInterceptor1 (com.navercorp.pinpoint.profiler.plugin.TestInterceptors.TestInterceptor1)6 TestInterceptor2 (com.navercorp.pinpoint.profiler.plugin.TestInterceptors.TestInterceptor2)5 TestInterceptor0 (com.navercorp.pinpoint.profiler.plugin.TestInterceptors.TestInterceptor0)4 TraceContext (com.navercorp.pinpoint.bootstrap.context.TraceContext)1 ApiMetaDataService (com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService)1