Since we have got JDK1.8 with CompletableFuture, everywhere I see everyone complaining
about Future. Everyone is complaining that it is blocking, there is no future in Future etc...
Well, I am not here to argue on this, as it is useless & don't see the same people complaining
about Future before JDK1.8.
Here, I am just saying that though Future.get() is blocking but we also have the workaround
for not to get blocked on this call i.e. Future.isDone(), use it.
Before CompletableFuture, we could have used it, if we are not supposed to start another
aync process on the completion of one future.
But using Future, it was difficult & tricky to chain the aync processes one after the other.
So, as per my understanding, this facility of chaining is the real power provided by
CompletableFuture.
Below is one small sample which you can try & provide your comments-
about Future. Everyone is complaining that it is blocking, there is no future in Future etc...
Well, I am not here to argue on this, as it is useless & don't see the same people complaining
about Future before JDK1.8.
Here, I am just saying that though Future.get() is blocking but we also have the workaround
for not to get blocked on this call i.e. Future.isDone(), use it.
Before CompletableFuture, we could have used it, if we are not supposed to start another
aync process on the completion of one future.
But using Future, it was difficult & tricky to chain the aync processes one after the other.
So, as per my understanding, this facility of chaining is the real power provided by
CompletableFuture.
Below is one small sample which you can try & provide your comments-
Futures