SingleThreadModel means that only one thread is allowed to run in your servlet at a time. So what is happening is with your first call to the servlet a thread starts to execute in the servlet - but it never leaves the servlet, as per yopur code. It thereby blocks the second call which will start a new thread that will try to run through the servlet but due to the fact the thread from the first call is still running in the servlet the second call's thread is blocked due to the restrictions of the SingleThreadModel.
So if anything the W2K implementation seems like it might be incorrect, but I suspect that it is setup differently, perhaps with a very short timeout. Cheers Adrian > -----Original Message----- > From: Patricio Vera S. [SMTP:[EMAIL PROTECTED]] > Sent: 09 December 2002 11:16 > To: [EMAIL PROTECTED] > Subject: Fw: servlet implementing SingleThreadModel > > Hello, > > I tried to understand the implementation of SingleThreadModel on > Jakarta-Tomcat servlet engine. > > The idea is run one instance of the servlet with the "opcion" > parameter > = SS so the servlet run in a cycle for ever and then call in a new window > the same servlet with the "opcion" parameter != SS, so I get the next > results : > > 1. In my tomcat 3.2.1 over Linux implementation I get timeout on the > second call of the servlet, even I configured tomcat with thread pool (i > attach part of the server.xml). > > 2. In my tomcat 4.1 over W2K implementation I get the correct answer > on > the second call of the servlet. > > So the question is : > > a. Is there any problem with the tomcat 3.2.1 version over Linux and > threads? > b. How I can configure tomcat 3.2.1 for thread safe? > > I appreciate any help or idea... thanks in advance. > > > > serThread Code : > > > > import javax.servlet.*; > > import javax.servlet.http.*; > > import java.io.*; > > import java.util.*; > > > > public class serThread extends HttpServlet implements SingleThreadModel > { > > > > //Initialize global variables > > public void init(ServletConfig config) throws ServletException { > > super.init(config); > > } > > > > //Process the HTTP Get request > > public void doGet(HttpServletRequest request, HttpServletResponse > > response) throws ServletException, IOException { > > // > > String sOpcion = ""; > > try { > > sOpcion = request.getParameter("opcion"); > > } catch (Exception e) { > > e.printStackTrace(); > > sOpcion = "No Option"; > > } > > response.setContentType("text/html"); > > PrintWriter out = new PrintWriter (response.getOutputStream()); > > > > if (sOpcion == null || sOpcion.equals("") ) > > sOpcion = "No Option"; > > > > if (sOpcion.equals("SS")) { > > while ( true ) > > ; > > } > > out.println("<html>"); > > out.println("<head><title>serThread</title></head>"); > > out.println("<body>"); > > out.println("<h1>Hello!!</h1>"); > > out.println("<h2>Opcion : " + sOpcion + "</h2>"); > > out.println("</body></html>"); > > out.close(); > > } > > > > //Get Servlet information > > public String getServletInfo() { > > return "serProcard.serThread Information"; > > } > > } > > > > server.xml : > > > > <Connector > className="org.apache.tomcat.service.PoolTcpConnector"> > > <Parameter > > name="handler" > > > > value="org.apache.tomcat.service.connector.Ajp13ConnectionHandler"/> > > <Parameter > > name="port" > > value="8041"/> > > <Parameter > > name="max_threads" > > value="30"/> > > <Parameter > > name="max_spare_threads" > > value="20"/> > > <Parameter > > name="min_spare_threads" > > value="5"/> > > </Connector> > > > > Saludos, > > Patricio Vera S. > > > > _______________________________________________________________ > Copa del Mundo de la FIFA 2002 > El único lugar de Internet con vídeos de los 64 partidos. > ¡Apúntante ya! en http://fifaworldcup.yahoo.com/fc/es/ > > __________________________________________________________________________ > _ > To unsubscribe, send email to [EMAIL PROTECTED] and include in the > body > of the message "signoff SERVLET-INTEREST". > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > Resources: http://java.sun.com/products/servlet/external-resources.html > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html -- It is the strict policy of Truworths that its e-mail facility and all e-mail communications emanating therefrom, should be utilised for business purposes only and should conform to high professional and business standards. Truworths has stipulated certain regulations in terms whereof strict guidelines relating to the use and content of e-mail communications are laid down. The use of the Truworths e-mail facility is not permitted for the distribution of chain letters or offensive mail of any nature whatsoever. Truworths hereby distances itself from and accepts no liability in respect of the unauthorised use of its e-mail facility or the sending of e-mail communications for other than strictly business purposes. Truworths furthermore disclaims liability for any unauthorised instruction for which permission was not granted. Truworths Limited accepts no liability for any consequences arising from or as a result of reliance on this message unless it is in respect of bona fide Truworths business for which proper authorisation has been granted. Any recipient of an unacceptable communication, a chain letter or offensive material of any nature is requested to notify the Truworths e-mail administrator ([EMAIL PROTECTED]) immediately in order that appropriate action can be taken against the individual concerned. ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html