SAP / cf-java-client-sap

Java Client Library for Cloud Foundry
Apache License 2.0
22 stars 28 forks source link

Fix high thread count issue #289

Closed radito3 closed 1 year ago

radito3 commented 1 year ago

The jdk 11's HttpClient keeps a SelectorManager thread alive for the lifetime of the HttpClient reference. It was observed that we create hundreds or even thousands of CloudControllerClients, each of which has a LogCacheClient, each with an HttpClient. This resulted in over 2.1K SelectorManager threads and was causing crashes.

This commit changes the lifecycle of the HttpClient used for application logs to be only for the scope of the method call.