Hi All,
Can anybody help me to clear this doupt
The Servlet container uses the servlet thread for servicing each client request but while writing the servlet code we neither implement the Runnable interface nor extend the Thread class then how the servlet container
can generate the pool of threads?
Thanks in advance
bye
Rama
-
Threading issue in servlets (1 messages)
- Posted by: Ramasubramanian Balasubramanian
- Posted on: February 21 2001 13:18 EST
Threaded Messages (1)
- Threading issue in servlets by Gordon Reynolds on February 22 2001 15:26 EST
-
Threading issue in servlets[ Go to top ]
- Posted by: Gordon Reynolds
- Posted on: February 22 2001 15:26 EST
- in response to Ramasubramanian Balasubramanian
I can't say I know the exact architecture, but I'd suggest that your servlet is invoked by another object that is already running on a thread. In a manner of speaking, your servlet 'inherits' the thread of the object that invokes it. The object that invokes your servlet is under the control of the server, not you.
However, you can force the server to allocate one instance of your servlet per thread rather than sharing the same instance among multiple threads. You'd do this if the servlet or JSP you had written was not thread safe. To accomplish this with servlets, they must implement the javax.servlet.SingleThreadModel interface. In JSP's, you add the JSP directive <%@ page isThreadSafe="false" %>.
Gordon.