Aaron Digulla created HTTPCLIENT-2188:
-----------------------------------------
Summary: Improve logging when BasicHttpClientConnectionManager is
still allocated
Key: HTTPCLIENT-2188
URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2188
Project: HttpComponents HttpClient
Issue Type: Improvement
Components: HttpClient (classic)
Affects Versions: 5.2-alpha1, 4.5.13
Reporter: Aaron Digulla
When {{BasicHttpClientConnectionManager}} reports that a connection is still
allocated, it should also print the name of the connection just like it does
when it closes the connection. That would make it easier to pinpoint which
connection wasn't released properly.
Please replace
{code:java}
Asserts.check(!this.leased, "Connection is still allocated"); {code}
with
{code:java}
Asserts.check(!this.leased, "Connection %s is still allocated", conn); {code}
Rationale: If leased is true, then conn must be != null.
At the end of the method
{{{}org.apache.http.impl.conn.BasicHttpClientConnectionManager.getConnection(HttpRoute,
Object){}}}, add logging about the connection:
{code:java}
if (this.log.isDebugEnabled()) {
this.log.debug("Using connection " + conn);
} {code}
Same for
{code:java}
Asserts.check(conn == this.conn, "Connection not obtained from this manager");
{code}
which should be
{code:java}
Asserts.check(conn == this.conn, "Connection %s not obtained from this manager
(%s)", conn, this.conn); {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]