You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Michael Becke <be...@u.washington.edu> on 2003/03/31 05:31:19 UTC

Connection reuse and threading

Hello All,

It has been a little while since I have posted anything regarding the 
multi-threading/connection reuse problems.  Please excuse the delay.  I 
have been thinking about the problems that Sergio and Carl have been 
having and have broken down the issues into the following three items:

1) There is currently no way to determine if a connection is still open 
on the server side.
2) If an IOException occurs while writing to a connection it cannot be 
reused.
3) There is no upper limit on the number of connections in the 
MultiThreadedHttpConnectionManager (MTHCM).

My plans for these problems are as follows:

1) I has been my experience that if a connection has been closed on the 
server side, writing to it causes an error.  Sometimes this is a 
SocketException, sometimes it is an IOException.  I plan to make all 
IOExceptions that occur when writing to a reused connection recoverable 
(not just the SocketExceptions).  This way the connection can be closed 
and then reconnected.

If anyone has another idea for how to determine if a connection has 
been closed I would appreciate it.

2) If an exception occurs while writing/reading from a socket it has 
become unusable for our purposes.  In this case the connection should 
automatically be closed.  This way a connection cannot be reused once 
it has IO problems.

3) I have begun work on an enhanced MTHCM that has a maximum connection 
value.  I will post a patch when something more is available.

Mike