⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timerinterceptor.java

📁 想学习EJB的同学
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package ejb3.day6;import javax.interceptor.AroundInvoke;import javax.interceptor.InvocationContext;/** * * @author user */public class TimerInterceptor {    @AroundInvoke    public Object timer(InvocationContext ic) throws Exception{        String bean = ic.getTarget().getClass().getName();        String method = ic.getMethod().getName();        long begin = System.currentTimeMillis();        Object ret = ic.proceed();        long end = System.currentTimeMillis();        System.out.println("calling " + method + " on " + bean + " takes " + (end - begin) + "ms");        return ret;    }}

⌨️ 快捷键说明

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