Class CancellableFuture<T>

java.lang.Object
java.util.concurrent.CompletableFuture<T>
org.jetbrains.bsp.bazel.server.bsp.CancellableFuture<T>
All Implemented Interfaces:
CompletionStage<T>, Future<T>

public class CancellableFuture<T> extends CompletableFuture<T>
JDK's CompletableFuture does not handle cancellation well. When a `cancel` method is called on a derived future, created with a transformation method like `thenApply`, the cancellation is not propagated back to the original future. Try this code to see the difference: ``` public static void main(String[] args) throws InterruptedException { var f1 = CancellableFuture.from(new CompletableFuture<>()); var f2 = f1.thenApply(x ->x); f2.cancel(true); System.out.println(f1.isCancelled()); } ``` If you remove "CancellableFuture.from" call, you will get `false` instead of `true`