diff --git a/cffu-core/src/main/java/io/foldright/cffu/ListenableFutureUtils.java b/cffu-core/src/main/java/io/foldright/cffu/ListenableFutureUtils.java index 71779d47..332db4f2 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/ListenableFutureUtils.java +++ b/cffu-core/src/main/java/io/foldright/cffu/ListenableFutureUtils.java @@ -50,7 +50,12 @@ public String toString() { } }; // propagate cancellation by CancellationException from outer adapter to LF - CompletableFutureUtils.peek(ret, (v, ex) -> lf.cancel(false)); + CompletableFutureUtils.peek(ret, (v, ex) -> { + ex = CompletableFutureUtils.unwrapCfException(ex); + if (ex instanceof CancellationException) { + lf.cancel(false); + } + }); Futures.addCallback(lf, new FutureCallback() { @Override