1 package test.perf.test1; 2 3 import java.lang.reflect.InvocationHandler ; 4 import java.lang.reflect.Method ; 5 6 import test.perf.*; 7 8 import alt.jiapi.*; 9 import alt.jiapi.reflect.*; 10 import alt.jiapi.util.*; 11 import alt.jiapi.interceptor.*; 12 13 18 public class InterceptorTest extends AbstractTest implements InvocationHandler { 19 private InstrumentationContext ctx; 20 Object foo; 21 22 public void init() { 23 try { 24 ctx = new InstrumentationContext(); 25 InstrumentationDescriptor id = new InstrumentationDescriptor(); 26 id.addInclusionRule("test.perf.*"); 27 ctx.addInstrumentationDescriptor(id); 28 29 InvocationInterceptor ii = 30 new InvocationInterceptor(id, "test.perf.Foo*",this); 31 } 32 catch(Exception e) { 33 System.out.println("ERROR: " + e); 34 } 35 } 36 37 public void test(int lCount) throws Exception { 38 Bootstrapper.launch("test.perf.Foo", null, ctx, 39 InstrumentingClassLoader.createClassLoader(ctx)); 40 } 41 42 public Object invoke(Object o, Method m, Object [] args) throws Exception { 43 return m.invoke(o, args); 44 } 45 } 46 | Popular Tags |