1 package samples.jazzpect; 2 3 import org.aopalliance.intercept.MethodInterceptor; 4 import org.aopalliance.intercept.MethodInvocation; 5 6 import alt.jiapi.jazzpect.Initializer; 7 8 13 public class Sample1 implements MethodInterceptor { 14 public static void main(String args[]) throws Exception { 15 String className = "samples.Foo"; 16 if (args.length > 0) { 17 className = args[0]; 18 } 19 20 new Sample1(className); 21 } 22 23 24 public Sample1(String className) throws Exception { 25 Initializer i = 28 new Initializer(new String [] {"samples.*"}, null, 29 "samples.*", this); 30 i.runMainMethod(className, null); 32 33 } 38 39 40 public Object invoke(MethodInvocation mi) throws Throwable { 42 long l1 = System.currentTimeMillis(); 44 Object o = mi.proceed(); 46 long l2 = System.currentTimeMillis(); 47 48 System.out.println("It took " + (l2-l1) + " ms to invoke " + 49 mi.getMethod().getName()); 50 51 return o; 52 } 53 } 54 | Popular Tags |