tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Tomcat 5.5 doesn't support keep-alive?
Date Mon, 16 May 2011 16:16:46 GMT
Hash: SHA1


On 5/16/2011 4:06 AM, Tim Stibbs wrote:
> I have a java client that is making a large number of calls to a servlet
> running in a web app in tomcat 5.5.28. I have noticed that if the client
> process runs for too long, the client machine runs out of ports throwing a
> " Address already in use: connect". I thought that
> java's URLConnection maintained an internal pool of connections, and that so
> long as keep alive was enabled it would re-use the connections.

The Javadoc for has this to say about the openConnection

"A new connection is opened every time by calling the openConnection
method of the protocol handler for this URL."

That seems to be conflicting with this other documentation:

... which says that keep-alive is transparent. I don't see you setting a
"Connection: keep-alive" header, which you probably should be doing. The
example code in the above document does /not/ explicitly set this
header, but it couldn't hurt.

You should also check this out:

Evidently, not properly reading the server's response could be a
problem, too. Note that HttpURLConnection requires that you monitor two
separate streams for responses: the output and error streams. You should
drain one or the other stream based upon the response code you get from
the server.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message