3 ms·
How can't a CF be cancelled? Since JDK8: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html#cancel-boolean- https://docs.ora
by vips7L 6y ago
How can't a CF be cancelled?
Since JDK8: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html#cancel-boolean- https://docs.oracle.com/javase/8/docs/api/java/util/concurre...
- mrkeen 6y ago> > A CF can't decide to sleep for a while, nor can it be cancelled. > How can't a CF be cancelled? So glad you brought up the docs. CF implements cancel(boolean mayInterruptIfRunning)... which does nothing ;) More precisely, it will not cancel a running CF. If the CF hasn't started yet, by all means cancel it. But if it's running, that cancel method does nothing.