Java - Handling Non-Blocking Calls
Posted
by sarav
on Stack Overflow
See other posts from Stack Overflow
or by sarav
Published on 2010-04-12T12:18:46Z
Indexed on
2010/04/12
12:23 UTC
Read the original article
Hit count: 203
In my application I am using a third-party API. It is a non-blocking method which returns immediately. I have a collection of elements over which I have to invoke this method.
Now, my problem is that I have to find a way till all the method execution gets completed and do my next operation. How can I handle this? I cannot modify the third-party API.
In short it looks like this
for(Object object: objects){
methodA(object); //this is a non-blocking call and returns immediately
}
// here I want to do my next task only after all the methodA calls completed execution
© Stack Overflow or respective owner