Yes, I have stopped using the deprecated ThreadSafeClientConnManager constructor.
I was using HttpRoute(HttpHost target)! I should have respected the javadoc and used this one: HttpRoute(HttpHost target, InetAddress local, boolean secure). Thank you so much, Sam! -----Original Message----- From: Sam Crawford [mailto:[email protected]] Sent: Monday, August 01, 2011 3:48 PM To: HttpClient User Discussion Subject: Re: Only create 2 connection per route If the non-deprecated constructor is working for you, then why not stick with that? (At least for now - I realise it could be a valid HttpClient bug) With regards to the SSL issue, have you definitely got the "secure" boolean set to true when constructing the HttpRoute? I may have missed an earlier post, but if you had a sample bit of code that reproduced this it'd be helpful. Thanks, Sam On 1 August 2011 23:11, Fang Lin <[email protected]> wrote: > The context logging is very helpful! Found two issues: > > I noticed that when ThreadSafeClientConnManager is created without the > BasicHttpParams, the setMaxForRoute (with value 15) works! > manager = new ThreadSafeClientConnManager (registry); > Log: > 2011/08/01 13:19:21:690 PDT [DEBUG] ConnPoolByRoute - Available > capacity: 15 out > of 15 [HttpRoute[{}->http://localhost:80]][null] > 2011/08/01 13:19:21:698 PDT [DEBUG] ConnPoolByRoute - Available > capacity: 14 out > of 15 [HttpRoute[{}->http://localhost:80]][null] > 2011/08/01 13:19:21:699 PDT [DEBUG] ConnPoolByRoute - Available > capacity: 13 out > of 15 [HttpRoute[{}->http://localhost:80]][null] > 2011/08/01 13:19:21:699 PDT [DEBUG] ConnPoolByRoute - Available > capacity: 12 out > of 15 [HttpRoute[{}->http://localhost:80]][null] > > To verify the case, I changed back to use the deprecated constructor: > manager = new ThreadSafeClientConnManager (params, registry); Both > setDefaultMaxPerRoute (with value 5)and setMaxForRoute (with value 15) had NO > effect. > Log: > 2011/08/01 13:54:00:627 PDT [DEBUG] ConnPoolByRoute - Available > capacity: 2 out of 2 [HttpRoute[{}->http://localhost:80]][null] > 2011/08/01 13:54:00:636 PDT [DEBUG] ConnPoolByRoute - Available > capacity: 1 out of 2 [HttpRoute[{}->http://localhost:80]][null] > 2011/08/01 13:54:00:636 PDT [DEBUG] ConnPoolByRoute - Available > capacity: 0 out of 2 [HttpRoute[{}->http://localhost:80]][null] > 2011/08/01 13:54:00:638 PDT [DEBUG] ConnPoolByRoute - Available > capacity: 0 out of 2 [HttpRoute[{}->http://localhost:80]][null] > > The same thing happened to https routes - only allocated 2 connections > (total) for a https route when using the deprecated constructor. > However, using ThreadSafeClientConnManager (registry), only > setDefaultMaxPerRoute (with value 5) worked but setMaxForRoute (with value > 15) did not work on a https route. And the total connection allocated is 5 > instead of 15. > Log: > 2011/08/01 14:09:03:621 PDT [DEBUG] ConnPoolByRoute - Available > capacity: 5 out of 5 > [HttpRoute[{s}->https://...washington.edu:443]][null] > 2011/08/01 14:09:03:629 PDT [DEBUG] ConnPoolByRoute - Available > capacity: 4 out of 5 > [HttpRoute[{s}->https://....washington.edu:443]][null] > 2011/08/01 14:09:03:629 PDT [DEBUG] ConnPoolByRoute - Available > capacity: 3 out of 5 > [HttpRoute[{s}->https://....washington.edu:443]][null] > 2011/08/01 14:09:03:630 PDT [DEBUG] ConnPoolByRoute - Available > capacity: 2 out of 5 > [HttpRoute[{s}->https://....washington.edu:443]][null] > 2011/08/01 14:09:04:632 PDT [DEBUG] ConnPoolByRoute - Available > capacity: 1 out of 5 > [HttpRoute[{s}->https://....washington.edu:443]][null] > ...... > ConnPoolByRoute - [HttpRoute[{s}->https://...s.washington.edu:443]] > total kept alive: 2, total issued: 3, total allocated: 5 out of 120 > > Any suggestion? > > -----Original Message----- > From: Oleg Kalnichevski [mailto:[email protected]] > Sent: Thursday, July 28, 2011 7:47 AM > To: HttpClient User Discussion > Subject: Re: Only create 2 connection per route > > On Wed, 2011-07-27 at 23:46 +0000, Fang Lin wrote: >> I am now puzzled by the following two cases with my >> ThreadSafeClientConnManager : >> 1. getConnectionsInPool (route) call shows that the value increased from 1 >> to 2 quickly, but never goes beyond 2. >> 2. getConnectionsInPool (route) always return zero for the https routes. >> Any ideas? >> > > Context logging is your best friend. > > Oleg > > > > --------------------------------------------------------------------- > 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]
