On Mon, 2006-09-18 at 09:37 -0400, Mark Claassen wrote: > Thanks for your help. My somewhat obvious follow-up question is: Can I > control this timeout? It doesn't look like HttpConnectionManagerParams has > a property for this. The only timeouts that are mentioned explicitly is the > connection timeout and the socket timeout (and the Linger I guess, if you > count this).
Mark, The connection manager timeout is set at the agent (HttpClient) level. The http.connection-manager.timeout parameter is your friend. > While it is blocked, will PostMethod.abort() unblock it? > Unfortunately not. This is a known limitation of HttpClient 3.x due to be resolved in HttpClient 4.0 https://issues.apache.org/jira/browse/HTTPCLIENT-475 Oleg > Mark > > > > -----Original Message----- > From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] > Sent: Sunday, September 17, 2006 2:14 PM > To: HttpClient User Discussion > Subject: Re: Using a connection directly from > theMultiThreadedHttpConnectionManager > > On Fri, 2006-09-15 at 08:49 -0400, Mark Claassen wrote: > > 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(httpCli > > ent.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? > > Mark, > > There's nothing wrong with acquiring a connection from the connection > manager. The trouble is that a lot of HTTP protocol logic is encapsulated in > the HttpClient class and is not executed if one is using HttpConnection > directly. > > > > Also, is the HttpConnectionManagerParams.setConnectionTimeout(xxx) the > > same as HttpConnecitonManager.getConnectionWithTimeout(xxx)? > > > > Not really. The first timeout value determines the maximum connect time (how > long HttpClient can spend blocked waiting for a new connection to be > established). The latter value is the time HttpClient can spend blocked > waiting for an _existing_ connection to be acquired from the pool > > Hope this helps > > Oleg > > > > Thanks, > > Mark > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
