Overview of Basic Java 8 CompletableFuture Features (Part 1)

preview_player
Показать описание
This video describes the basic features of Java 8 completable futures, including get()/join(), cancel(), isDone(), isCancelled(), complete(), and completedFuture().
Рекомендации по теме
Комментарии
Автор

Prof Doug,
I believe Since CompletableFuture does not keep the reference of the task, so, it will not be able to cancel the task, and also it will not have any idea about which thread in the fork join Pool will actually run that task, so it can't interrupt that thread, whereas the regular Future implementations like FutureTask keeps the reference of the associated Callable and so cancel() can be easily implemented based on the state of FutureTask
Regards,
Sanjeev

SanjeevKumar-hjfb
Автор

Prof Doug, Is it true that if we call join() on a CompletableFuture and there are no available threads in the FJ Pool, the thread invoking join() actually runs the corresponding task? I think this is how join() on FJTask works?
Regards,
Sanjeev

SanjeevKumar-hjfb