package cn.abc.util;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.StopWatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class MethodTimeAdvice implements MethodInterceptor
{
protected final Log log =
LogFactory.getLog(MethodTimeAdvice.class);
public Object invoke(MethodInvocation invocation) throws
Throwable {
// 用 commons-lang 提供的 StopWatch 计时,Spring 也提供了一个
StopWatch
StopWatch clock = new StopWatch();
clock.start(); // 计时开始
String beforeTime = new SimpleDateFormat("yyyy-MM-dd
HH:mm:ss:SSS").