Hello, Using Apache HTTP Client 4.3+, and when tracking down an unrelated issue in output from my own tests, I noticed a lot of messages like this showing up in logs:
[Finalizer] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Connection manager is shutting down I suspected that I had a resource leak. I creating my CloseableHttpClient instances using the HttpClients.custom() builder and specifically providing an instance (new, unique, dedicated) of PoolingHttpClientConnectionManager. I'd checked (by looking at the source code) that calling .close() on the resulting HTTP client instance should have called shutdown() on the connection manager, so I was a bit confused about why the connection manager appeared to only get shut down by a finalizer (I assumed resource leakage on my part or a bad understanding of how I should close the HTTP client). After investigation, it appears that this message is ALWAYS logged, because finalize() ALWAYS calls shutdown(), and shutdown() ALWAYS claims that it's shutting down something... even when it's already shutdown. Maybe you could add a simple volatile boolean flag to the connection manager so that calls from the finalizer don't generate misleading log messages? Thanks, Christopher
