commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoan Nikolaev" <>
Subject RE: HTTP Client: HttpConnection patch
Date Sun, 13 Jan 2002 22:47:03 GMT
Hi, I am new to this list, but very interested in your HttpClient.
You are talking about reding system properties for the timeouts.
JDK1.4 already has such properties, you might want to use the same in
your 1.3 implementation,
So when you migrate to 1.4, you won't have to do anything more.
Let me know If I make sense...

-----Original Message-----
From: Otis Gospodnetic [] 
Sent: Sunday, January 13, 2002 4:11 PM
Subject: HTTP Client: HttpConnection patch


A few times I mentioned that HttpConnection hangs when it encounters 
servers that are down, unreachable, etc.
I did a bit of debugging and it appears that it is calls to 'new 
Socket(....)' that are blocking.  Furthermore, it looks like there is no

simple cure for that in Java's version 1.3 of the API.

However, JDK 1.4 exposes a 'connect' method in Socket class, which 
allows a timeout value to be specified.

I modified my local version of HttpClient to use that and it works 
perfectly.  I was doing tests with a set of about 1150 URLs and 10 
threads.  Before this change it would take about 16 minutes to fetch 
1150 pages, and now it takes about 3. Note that I hard-coded the connect

timeout value, but I realize that the default value should probably be 
in a static final int and that we should probably expose this via a 
public method that allows one to set the timeout value.

I understand that not everyone will want to use it, but it may be good 
to apply this patch anyway and then comment it out, so that it is easy 
for people to uncomment it out and use it.  Or perhaps HttpConnection 
could check one of the System properties that shows the JVM version and
use either the old or the new code, depending on the property.

What do you think?


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

View raw message