下面的这段源码里面的UtilTimerStack是做什么用的?
String timerKey = "FilterDispatcher_doFilter: ";
        try {
            UtilTimerStack.push(timerKey);//?????????????????????
            request = prepareDispatcherAndWrapRequest(request, response);
            ActionMapping mapping;
            try {
                mapping = actionMapper.getMapping(request, dispatcher.getConfigurationManager());
            } catch (Exception ex) {
                LOG.error("error getting ActionMapping", ex);
                dispatcher.sendError(request, response, servletContext, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex);
                return;
            }            if (mapping == null) {
                // there is no action in this request, should we look for a static resource?
                String resourcePath = RequestUtils.getServletPath(request);                if ("".equals(resourcePath) && null != request.getPathInfo()) {
                    resourcePath = request.getPathInfo();
                }                if (serveStatic && resourcePath.startsWith("/struts")) {
                    String name = resourcePath.substring("/struts".length());
                    findStaticResource(name, request, response);
                } else {
                    // this is a normal request, let it pass through
                    chain.doFilter(request, response);
                }
                // The framework did its job here
                return;
            }            dispatcher.serviceAction(request, response, servletContext, mapping);        } finally {
            try {
                ActionContextCleanUp.cleanUp(req);
            } finally {
                UtilTimerStack.pop(timerKey);
            }
        }

解决方案 »

  1.   

    应该是计时用的,计算这个操作用了多长时间。
    后面还有段代码:UtilTimerStack.pop(timerKey); 这段代码是操作结束时,记录时间的日志操作。
      

  2.   

    内置性能诊断类
    可以用来测试一些逻辑操作所消耗的时间(以毫秒为单位),其本身使用一个ArrayList作为存放ProfilingTimerBean的容器,而行为以Stack栈(后入先出)为主