I have been using the HttpClient for a while now and really like it.
However, I noticed the other day that I was doing the pooling incorrectly.
I was working on it when I got a bit confused.

Since I was used to using the java.net.* stuff, I took that approach and got
an HttpConnection from the connection manager.  Once I got the connection, I
made the transaction and then released the connection.  The algorithm I was
using was basically like this:

connection =
httpClient.getHttpConnectionManager().getConnectionWithTimeout(httpClient.ge
tHostConfiguration(),30000);
post = new PostMethod(...)
post.execute(httpClient.getState(),connection);
...
connection.releaseConnection();

However, this didn't really work at all.  My application would just hang for
long periods and then I would get socket errors.  Since then I switched to
using the same algorithm as in the examples and everything works great.

post = new PostMethod()
httpClient.executeMethod(post);
post.releaseConnection();

Was there something wrong with getting the connection first?  
Also, is the HttpConnectionManagerParams.setConnectionTimeout(xxx) the same
as HttpConnecitonManager.getConnectionWithTimeout(xxx)?

Thanks,
Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to