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 unde开发者_如何学Crstanding, 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 should take a serious look at Akka, and specifically, the Camel support it offers.
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
精彩评论