actiontimerinterceptor.java

来自「Struts2 + Spring JPA Hibernate demo.」· Java 代码 · 共 25 行

JAVA
25
字号
package com.vegeta.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class ActionTimerInterceptor implements Interceptor {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public String intercept(ActionInvocation invocation) throws Exception {
		long t1 = System.currentTimeMillis();
		String target = invocation.invoke();
		long t2 = System.currentTimeMillis();
		System.out.println("Action " + invocation.getAction().getClass().getName() + " took " + (t2 - t1) + " millisecs");
		return target;
	}

	public void init() {
	}

	public void destroy() {
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?