Originally posted by Bear Bibeault:
Each request, running in its own thread, gets its own HttpServletRequest and HttpServletResponse instances and output buffer. You don't need to worry about them overlapping.
Yes, I knew that part. Let me see if this is a better example of what is confusing me:
int x = 20;
x = 10;
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<div>" + x + "</div>");
How do you know a 2nd thread won't be assigning 20 to x, just before this thread adds the value of x to the response? I don't see how setting x = 10 is isolated inside one particular request; it's inside the
servlet's doPost() method, which all the threads access.
[ October 10, 2006: Message edited by: sven studde ]