I am sending a request to some servers in parallel but their responses don't come at the same time. I have to show the response on an html page. One way is to wait for all the responses and when all the responses arrive, show them. What I want to do is to show a response as soon as it comes and don't wait for other responses. A rough algorithm looks like:
while(all the responses don't come or timeout occurs)
waitForResponse();
if(responseArrived==true){
//put it on html page
}
}
How can I do it in java?