hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Becke <be...@u.washington.edu>
Subject Re: MultiThreadedHttpConnectionManager Questions
Date Thu, 10 Apr 2003 02:53:48 GMT
Hi Adrian,

> Firstly, the method:
> public HttpConnection getConnection(HostConfiguration 
> hostConfiguration)
>
> has a while (true) loop that catches and logs all HttpExceptions.  The 
> method doesn't claim to thrown IOExceptions so it looks like if 
> something goes wrong it will loop forever.  I can't believe noone's 
> run into this problem yet (though it may be contributing to some of 
> the threads going awol in bug 18596 that Mike has been working on).  I 
> have asked the user to file a bug report on this to be sure the 
> concern isn't lost anyway.

This method looks a little suspicious at first I agree.  Though, as it 
turns out the HttpException is only thrown when a connection wait 
timeout occurs.  In the case of  getConnection(HostConfiguration) this 
will  never occur since we are waiting indefinitely.  The 
try/catch/loop is just there to make the compiler happy, and the LOG 
statement was added for completeness.  I have added a comment detailing 
this to my latest patch for bug 18596.

> Secondly, an enquiry came through regarding how to determine the 
> number of "connections available" (where "connections available" means 
> free connections + connections that can be created before reaching 
> maxConnections).  I suggested:
>
> manager.getMaxConnectionsPerHost() - 
> manager.getConnectionsInUse(hostConfiguration);
>
> However the proposed patch for bug 18596 makes this more complex.  So 
> could there be a request for a method that determines how many 
> connections can be made gets added?

The patch for 18596 has methods for getting the max number of 
connections and the total number in use.  Are you also wondering how 
many idle connections there are?

Mike


Mime
View raw message