On Mon, 2014-04-14 at 14:12 +0200, Christopher BROWN wrote: > 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
Christopher I am currently in the process of making changes to that particular area of code in SVN trunk (4.4 branch) and am going to straighten out PoolingHttpClientConnectionManager's logging upon shutdown. Fee free to raise a JIRA for this issue if you want to be notified of its resolution. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
