[concurrency-interest] CompletableFuture with delay

Zhong Yu zhong.j.yu at gmail.com
Mon Aug 25 11:32:44 EDT 2014

If you expose it as CompletableFuture, the caller is able to complete() it.
If you expose it as CompletionStage, the caller has no way to "cancel()" it.

Also note that CompletableFuture composition does not propagate
cancellation. If the caller of your supplyAsyncWithTimeout() decides to
cancel the returned future for some other reason, it will not trigger
`compute.cancel()` or `task.cancel()`.

    future1 = ...
    future2 = future1.whenComplete(...)
    future2.cancel()  // does not affect future1

Zhong Yu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20140825/713b32b9/attachment.html>

More information about the Concurrency-interest mailing list