Is this example uses multiple threads for each request.
No, it does not
how many threads it will support based in CPU
By default the underlying I/O reactor starts one I/O dispatch thread per CPU core
Is this example is Thread Safe
This question is just too vague. Exactly what class instances are you talking about?
Thread-safety rules that apply to both blocking HttpClient
and non-blocking HttpAsyncClient
are
- clients are thread-safe
- connection managers are thread-safe
- request / response messages are not thread safe
- contexts are not thread safe
As far as HttpAsyncClient
is concerned, as long as you do not use additional threads to process / generate content, HttpAsyncClient
ensures proper access synchronization of all components involved.