OpenFeign / feign

Feign makes writing java http clients easier
Apache License 2.0
9.42k stars 1.92k forks source link

How does Feign's ApacheHttpClient close the underlying CloseableHttpClient? #1603

Closed manouti closed 1 year ago

manouti commented 2 years ago

I'm looking at ApacheHttpClient, and was wondering about something: it internally creates an HttpClient to perform the http requests, but doesn't seem to be closing it.

public ApacheHttpClient() {
   this(HttpClientBuilder.create().build());
}

More specifically if I look at the builder method, it returns an instance of a CloseableHttpClient which according to its documentation, it should be closed:

When an HttpClient instance is no longer needed and is about to go out of scope it is important to shut down its connection manager to ensure that all connections kept alive by the manager get closed and system resources allocated by those connections are released.

CloseableHttpClient httpClient = <...>
httpClient.close();

I'm wondering if anyone has had issues with it, or maybe I'm missing something around Feign's usage of the client.

kdavisk6 commented 1 year ago

Questions like this are more appropriate for Stack Overflow. Issues in this repository are for bug fixes and feature requests for the project.