hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Roepcke <...@roepcke.com>
Subject Re: Making ContentLengthInputStream stop when I want, is this safe?
Date Sun, 03 Jul 2005 02:23:33 GMT
On 2-Jul-05, at 6:47 PM, Jim Roepcke wrote:

> I did try get.abort() before devising the workaround, but after  
> calling abort, subsequent HTTP methods weren't being executed.  ...  
> I just tried it again.  It works a few times but then eventually  
> HTTP methods just don't execute.  My guess is, since the  
> connections aren't (as far as I can tell) being released to the  
> pool when you call abort(), eventually the  
> MultiThreadedHttpConnectionManager's connection pool is starved and  
> it has nothing to offer the HttpClient.

I've done some more debugging.  I think I was right, the thread that  
calls client.execute is blocked, waiting in  
MultiThreadedHttpConnectionManager.doGetConnection (which is called  
by MultiThreadedHttpConnectionManager .getConnectionWithTimeout,  
called by HttpMethodDirector.executeMethod).

The timeout value would appear to be the default of 0 (since I didn't  
configure that in any way), which appears to mean no timeout, which  
explains why the QueuedExecutor handling my transfer commands is  
blocked.

 From the looks of things (please correct me if I'm wrong) even if I  
set a timeout value it would just result in client.execute method  
throwing a connection pool timeout exception instead of having the  
connection pool re-stock itself with new connections.

Is this the intended behavior of abort(), or should it be notifying  
the connection manager so it can clean up and keep the connection  
pool stocked?

> Looking at abort(), it calls close() on the connection, but not  
> releaseConnection(), which would in turn call  
> httpConnectionManager.releaseConnection(this).  I assume this is  
> why you say it won't be re-used?  On a quick inspection, I don't  
> see the MultiThreadedHttpConnectionManager being notified that the  
> connection is finished or unusable.  Do I have to either tell it  
> somehow or create a new connection manager?  It doesn't appear abort 
> () does anything to tell the connection manager the connection is  
> now unusable.

Thanks again for your help,

Jim



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message