@Override
 public void onError(AsyncEvent event) throws IOException {
   HttpServletResponse response = (HttpServletResponse) event.getSuppliedResponse();
   response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR_500);
   event.getAsyncContext().complete();
   latch.countDown();
 }
 @Override
 public void onError(AsyncEvent event) throws IOException {
   ServletResponse resp = event.getAsyncContext().getResponse();
   resp.getWriter().write("onError-");
   resp.flushBuffer();
   if (completeOnError) {
     event.getAsyncContext().complete();
   }
 }
 @Override
 public void onTimeout(AsyncEvent event) throws IOException {
   ServletResponse resp = event.getAsyncContext().getResponse();
   resp.getWriter().write("onTimeout-");
   resp.flushBuffer();
   if (completeOnTimeout) {
     if (dispatchUrl == null) {
       event.getAsyncContext().complete();
     } else {
       event.getAsyncContext().dispatch(dispatchUrl);
     }
   }
 }
 @Override
 public void onTimeout(AsyncEvent event) throws IOException {
   // Remove before it's redispatched, so it won't be
   // redispatched again at the end of the filtering.
   AsyncContext asyncContext = event.getAsyncContext();
   _queues[priority].remove(asyncContext);
   asyncContext.dispatch();
 }
 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();
   }
 }
 public void onTimeout(AsyncEvent arg0) throws IOException {
   log.error(
       "<" + ServletUtil.getUrl((HttpServletRequest) arg0.getSuppliedRequest()) + ">异步处理超时");
 }
 @Override
 public void onStartAsync(AsyncEvent event) throws IOException {
   ServletResponse resp = event.getAsyncContext().getResponse();
   resp.getWriter().write("onStartAsync-");
   resp.flushBuffer();
 }
 @Override
 public void onError(AsyncEvent event) {
   handleError(event.getThrowable());
 }
 @Override
 public void onTimeout(AsyncEvent event) {
   logger.info("MyAsyncListener is timeout:" + event.toString());
 }
 @Override
 public void onComplete(AsyncEvent event) {
   logger.info("MyAsyncListener is completed:" + event.toString());
 }
 @Override
 public void onStartAsync(AsyncEvent event) throws IOException {
   logger.info("MyAsyncListener is started:" + event.toString());
 }
 @Override
 public void onTimeout(AsyncEvent event) throws IOException {
   _queues[priority].remove(event.getAsyncContext());
   super.onTimeout(event);
 }
 @Override
 public void onTimeout(AsyncEvent event) throws IOException {
   event.getAsyncContext().dispatch();
 }
Example #14
0
 @Override
 public void onStartAsync(AsyncEvent event) throws IOException {
   event.getAsyncContext().addListener(this);
 }
 @Override
 public void onTimeout(AsyncEvent event) throws IOException {
   event.getAsyncContext().complete();
 }
 @Override
 public void onError(AsyncEvent event) {
   logger.info("MyAsyncListener encouter error:" + event.toString());
 }
 @Override
 public void onComplete(AsyncEvent event) throws IOException {
   if (clients.remove(event.getAsyncContext()) && clientcount.decrementAndGet() == 0) {
     ticker.removeTickListener(this);
   }
 }
 @Override
 public void onTimeout(AsyncEvent event) {
   Throwable ex = event.getThrowable();
   ex = (ex != null ? ex : new IllegalStateException("Async operation timeout."));
   handleError(ex);
 }