hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lott <mai...@invest-faq.com>
Subject Re: Warning: SimpleHttpConnectionManager being used incorrectly
Date Wed, 18 Nov 2009 12:52:28 GMT
I am writing a follow-on to the thread started by Christoph Jaehnigen on 
Wed, 23 Sep 2009 15:05:35 GMT about warnings emitted by the Apache 
HttpClient SimpleHttpConnectionManager.  I am using 
commons-httpclient-3.1-rc1. This message appears:

 >org.apache.commons.httpclient.SimpleHttpConnectionManager
 >getConnectionWithTimeout
 >WARNING: SimpleHttpConnectionManager being used incorrectly.  Be sure
 >that HttpMethod.releaseConnection() is always called and that only one
 >thread and/or method is using this connection manager at a time.

Below I have attached a simplified class that reproduces the problem. 
You can see that the code is single threaded and always, always calls 
method.releaseConnection().  Yet the warning still appears.  Frustrating!

After some goofing I think I may have stumbled upon a workaround, and 
would like to get your input. Basically I added a call to method.abort() 
in the exception clause triggered by timeout.  If that is done, I get no 
warning from SimpleConnectionManager.  Is this the right thing to do, or 
is there some deeper issue to be solved?

Please reply, thanks.

chris...

p.s.  I see now that HC 4.0 is available, I better try that, huh?

Mime
View raw message