I have an Responseobject for representing an post response to a web service. Given this code:
Response resp1= Server.request(a);
Response resp2= Server.request(b);
Response resp3= Server.request(c);
if (resp1.isOk() && resp2.isOk() && resp3.isOk()){
// Do stuff
}
Since the server is a little slow I’d like to parallelize the petitions in 3 threads. But I’m don’t know how to make the main thread to wait for the result and retrieve the 3 responses.
I guess you could do something like that to launch the calls in 3 threads and wait for their termination: