HTTPCLIENT-2188 - Improve logging when BasicHttpClientConnectionManager is still allocated

This commit is contained in:
Arturo Bernal 2022-01-11 18:53:56 +01:00 committed by Oleg Kalnichevski
parent dd0bbda070
commit d2a9977290
1 changed files with 4 additions and 1 deletions

View File

@ -303,7 +303,7 @@ public class BasicHttpClientConnectionManager implements HttpClientConnectionMan
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("{} Get connection for route {}", id, route); LOG.debug("{} Get connection for route {}", id, route);
} }
Asserts.check(!this.leased, "Connection is still allocated"); Asserts.check(!this.leased, "Connection %s is still allocated", conn);
if (!LangUtils.equals(this.route, route) || !LangUtils.equals(this.state, state)) { if (!LangUtils.equals(this.route, route) || !LangUtils.equals(this.state, state)) {
closeConnection(CloseMode.GRACEFUL); closeConnection(CloseMode.GRACEFUL);
} }
@ -318,6 +318,9 @@ public class BasicHttpClientConnectionManager implements HttpClientConnectionMan
this.conn.activate(); this.conn.activate();
} }
this.leased = true; this.leased = true;
if (LOG.isDebugEnabled()) {
LOG.debug("{} Using connection {}", id, conn);
}
return this.conn; return this.conn;
} }