博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

EJB Exception Interceptor 实现

Posted on 2011-11-01 16:56  钟悍  阅读(260)  评论(0编辑  收藏  举报
/**

 * 被拦截的方法

 * /

@Interceptors (CAProxyExceptionInterceptor.class)
public void processMessage(NotificationMessage msg) throws Exception {
    //todo
}

 

/**

 * 执行拦截的类

 * /

publicclass CAProxyExceptionInterceptor {
    /**

     * 拦截方法

     */ 

    @AroundInvoke
    public Object handleException(InvocationContext ctx) throws Exception {
        Object o = null;
        try {
            o = ctx.proceed();
        } catch (Exception e) {

            //todo

        }
    }
}