Class HttpClientManager


  • @ApplicationScoped
    public class HttpClientManager
    extends Object
    Provides efficient usage of HttpClient instances by keeping them in a cache so they can be reused to execute multiple HTTP requests without the overhead of building a new client for each of them. To avoid resource leaks due to having HttpClient references in memory, the cache is invalidated after a certain period of time so the cached instances can be disposed by the garbage collector. If an HttpClient is requested to the cache after it has been invalidated, a fresh new HttpClient is created and returned.