protected void doFilterChain(
     FilterChain chain, final HttpServletRequest request, final HttpServletResponse response)
     throws IOException, ServletException {
   final Thread thread = Thread.currentThread();
   Runnable requestTimeout =
       new Runnable() {
         @Override
         public void run() {
           closeConnection(request, response, thread);
         }
       };
   Scheduler.Task task =
       _scheduler.schedule(requestTimeout, getMaxRequestMs(), TimeUnit.MILLISECONDS);
   try {
     chain.doFilter(request, response);
   } finally {
     task.cancel();
   }
 }
Exemple #2
0
 private void cancelTimeout(Map<String, Object> ctx) {
   Scheduler.Task timeoutTask = (Scheduler.Task) ctx.get(TIMEOUT_FIELD);
   if (timeoutTask != null) {
     timeoutTask.cancel();
   }
 }
 private void cancelTask() {
   Scheduler.Task task = this.task;
   if (task != null) task.cancel();
 }
 public boolean cancel() {
   org.eclipse.jetty.util.thread.Scheduler.Task task = _task;
   return task != null && task.cancel();
 }