Tomcat/JSP - multiple concurrent connections from same client

J

Joe

Hi,

I was attempting to do some testing of some thread based code, so had
a JSP with a deliberate delay loop inside it so that I could lock
something for a period of time, when I noticed the following.

I opened three webrowsers (IE) on my Windows XP box and pointed each
in turn at the following JSP page (being served directly by Tomcat
v4.1.27 on port 8080 on a Linux box):

<%@ page import="my.log.package.*" %>
<%
int waitfor = 0;
String timer = request.getParameter("wait");
if (timer != null) waitfor = (new Integer(timer)).intValue();

Log.info("jsp", "I'm here and waiting: " +
request.getParameter("id"));
%>

<html>
<head>
<title>Thread Test</title>
</head>
<body>

<p>Just a simple thread test.</p>

<%
if (waitfor > 0){
for (int i = 0; i < waitfor * 1000000; ) { i = i + 1; }
}

Log.info("jsp", "... finished " + request.getParameter("id"));
%>

</body>
</html>

--------

So the browsers were pointed at:

threadtest.jsp?id=1&wait=5000
threadtest.jsp?id=2&wait=5000
threadtest.jsp?id=3

If I start the first two off so that they're both waiting for the loop
to finish before getting their pages, and then set the third going, it
blocks until one of the others returns and then comes through.

The logs (my custom log) confirms this.

I've tried it on another XP machine as well.

So I then did the same test, but with the first two URL's accessed on
one machine, and the third accessed from another concurrently, and all
behaved as you might expect - ie. the third received the page
immediately.

Anyone any ideas what's going on? Is there some kind of
connection-per-machine thing that I don't know about?

Cheers,
Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top