In a web service environment, I want to make a few independent http calls per each request that my application receives. As these calls are independent, it doesn't make sense to make them serially so I need a sort of concurrency.
To my understanding, it doesn't make sense to carelessly create new threads for each http call. And also, recreating all these threads brings a lot of overhead.
So I think my best option would be to create a FixedThreadPool in a singleton for all http calls and use that across the application.
Is this the best choice?
You may want to consider using the AsyncHttpClient AsyncHttpClient library for very easy asynchronous http calls. A good series of blog posts that describes how to use this library is Going Asynchronous using AsyncHttpClient
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.