You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Antonio Si <An...@oracle.com> on 2000/08/12 00:37:51 UTC

Servlet multi-threading question ...

Hi,

I have a servlet, CLASSA, which instantiate a singleton object
in the init() method. In the doGet() method, it access
the singleton object. The singleton object perform some
tasks based on an input parameter, event, and write the result
to the HttpServletResponse object.

I also have an HTML file with a Frameset definition as
follows:

<FRAMESET>
  <FRAME SRC = "/servlet/CLASSA?event=A", NAME=A>
  <FRAME SRC = "/servlet/CLASSA?event=B", NAME=B>
</FRAMESET>

If my servlet implements SingleThreadModel, the output is
fine, meaning the frame A and frame B got their
content properly. However, if the servlet does not implement
SingleThreadModel, the two frames got mixed up. Sometimes,
both frames will get content from "event=A", while sometimes,
both frames will get otherwise.

My singleton object only uses local variables. I am also only
using the http listener of tomcat only, i.e., apache is not
set up. I am not sure if that will make any difference.

Any pointer and suggestion to this problem would be highly
appreciated.

Thanks.

Antonio.
========