I've a query regarding HttpClient. Do you think for a multi-threaded application, is it a good idea to instantiate a new HttpClient object for each and every incoming request?
HttpClients.custom()
.setConnectionManager(new PoolingHttpClientConnectionManager())
.build();
If not, then in that case we will have only one HttpClient object. Now that singleton HttpClient object can be shared by many threads for rest call execution.
Upon successful execution of our rest call, we usually close the httpclient object inside finally block using HttpClients.closequietly()
Don't you think that closing the singleton httpclient object will create problems in a multi-threaded environment.
How should we handle the scenario then?