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.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to