Servlet requests are executed sequentially for no apparent reason in Glassfish v3
Posted
by Fabien Benoit
on Stack Overflow
See other posts from Stack Overflow
or by Fabien Benoit
Published on 2010-05-02T22:55:03Z
Indexed on
2010/05/02
22:57 UTC
Read the original article
Hit count: 369
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
© Stack Overflow or respective owner