Servlet requests are executed sequentially for no apparent reason in Glassfish v3
- by Fabien Benoit
Hi,
I'm using Glassfish 3 Web profile and can't get http workers to execute concurrently requests on a servlet.
This is how i observed the problem. I've made a very simple servlet, that writes the current thread name to the standard output and sleep for 10 seconds :
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println(Thread.currentThread().getName());
try {
Thread.sleep(10000); // 10 sec
}
catch (InterruptedException ex) {}
}
}
And when i'm running several simultaneous requests, I clearly see in the logs that the requests are sequentially executed (one trace every 10 seconds).
INFO: http-thread-pool-8080-(2)
(10 seconds later...)
INFO: http-thread-pool-8080-(1)
(10 seconds later...)
INFO: http-thread-pool-8080-(2)
etc.
All my GF settings are untouched - it's the out-of-the-box config (the default thread pool is 2 threads min, 5 max if I recall properly).
...I really don't understand why the sleep() block all the others worker threads. Any insight would be greatly appreciated !
Thanks,
Fabien