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]

Reply via email to