1 16 17 package org.springframework.aop.interceptor; 18 19 import org.aopalliance.intercept.MethodInvocation; 20 import org.apache.commons.logging.Log; 21 22 import org.springframework.util.StopWatch; 23 24 36 public class PerformanceMonitorInterceptor extends AbstractMonitoringInterceptor { 37 38 41 public PerformanceMonitorInterceptor() { 42 } 43 44 50 public PerformanceMonitorInterceptor(boolean useDynamicLogger) { 51 setUseDynamicLogger(useDynamicLogger); 52 } 53 54 55 protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable { 56 String name = createInvocationTraceName(invocation); 57 StopWatch stopWatch = new StopWatch(name); 58 stopWatch.start(name); 59 try { 60 return invocation.proceed(); 61 } 62 finally { 63 stopWatch.stop(); 64 logger.trace(stopWatch.shortSummary()); 65 } 66 } 67 68 } 69 | Popular Tags |