What happens if the programmer writes an infinite request? 

What if we have a servlet that may take a very long or infinite time to 
complete? Does that mean that every time some one sends a request to that 
servlet, one of the threads goes away to execute the servlet and never comes 
back? Is there any way that JBoss can monitor and kill such a thread?

Example servlet:



  |     protected void doGet(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {
  |             try {
  |                     String s = request.getParameter("N");
  |                     int N = Integer.parseInt(s);
  |                     PrintWriter writer = response.getWriter();
  |                     for (int i=0; i<N; i++){
  |                             writer.println(i + "/" + N);
  |                             System.out.println(i + "/" + N);
  |                             Thread.sleep(1000);
  |                     }
  |             } catch (NumberFormatException e){
  |                     throw new ServletException(e);
  |             } catch (InterruptedException ie){
  |                     throw new ServletException(ie);
  |             }
  |     }
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131149#4131149

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131149
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to