コード例 #1
0
 public void onComplete(AsyncEvent arg0) throws IOException {
   HttpServletRequest req = (HttpServletRequest) arg0.getSuppliedRequest();
   long t = System.nanoTime();
   String url = req.getRequestURI();
   long excuteTime = (long) req.getAttribute(RequestKeyEnum.REQUEST_EXCUTE_TIME);
   long triggerTime = (long) req.getAttribute(RequestKeyEnum.REQUEST_TRIGGER_TIME);
   arg0.getSuppliedResponse().getWriter().close();
   log.error(
       url
           + "  总耗时:"
           + (t - triggerTime) / 1000000.0
           + "毫秒   执行耗时:"
           + (t - excuteTime) / 1000000.0
           + "毫秒");
   if (req instanceof AppHttpServletRequest) {
     ((AppHttpServletRequest) req).destroy();
   }
 }
コード例 #2
0
 public void onTimeout(AsyncEvent arg0) throws IOException {
   log.error(
       "<" + ServletUtil.getUrl((HttpServletRequest) arg0.getSuppliedRequest()) + ">异步处理超时");
 }