On Tue, 2011-02-15 at 11:38 +0200, Maxim Veksler wrote: > Hello everyone, > > I'm doing a small stress run from my Workstation to my Laptop. > The code is attached below. > > This code emulates a situation where the connection pool runs out of > connections. I'm seeking to catch this situation and act properly. > My problem is that after a connection is being aborted it is never renewed. > Which leaves ThreadSafeClientConnManager completely unable to serve new > requests. > > I've traced this by putting a break point on > "System.out.println(Thread.currentThread().getName() + ": START " + new > Date());" then I've stepped all the 4 threads to > "HttpResponse response = httpClient.execute(httpGet, httpContext);" > (ensuring that non of them is in the middle of a session). After the > exception occurs all threads > fail to issue another request, and the ThreadSafeClientConnManager does not > renew it's pool of connections. > > I'm looking for a situation that the code will be safe maintaining, meaning > the ThreadSafeClientConnManager will be able to renew "failed" connections, > this will allow me to reattempt event resubmission. > > // p.s. On a side note, I would appreciate a quick code review of the usage > with httpclient in the attached sample as I'm new to the library. >
The connect timeout of 200 ms is probably too aggressive. Connection lease requests likely time out before the connection manager is able to allocate a connection. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
