For an instance, when 3 requests comes to a servlet that implements SingleThreadModel and the number of instances and number of threads that would be active at a given time.
Can someone explain how it creates a new instance per request.
sven studde
I looked at the super classes of HttpServlet and they don't appear to extend Thread or implement Runnable either. Anyone
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
So I think the implementation of the container has methods that spawn a new thread for a new request for a servlet.
Originally posted by William Brogden:
Since creating a new Thread is not cheap, servlet containers maintain a thread pool and assign instances as needed to respond to requests. With Tomcat you can control the maximum number of Threads in the pool.
Bill
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
But with this multi-thread pool there can be pool-related deadlocks ,thread leakages too.and what about concurrency isssues, since they rely on wait() and notify() which can be tricky. How do the containers handle these?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |