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 b52c5e55..d53d4da8 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/ListenableFutureUtils.java +++ b/cffu-core/src/main/java/io/foldright/cffu/ListenableFutureUtils.java @@ -33,7 +33,7 @@ public class ListenableFutureUtils { * Cancelling the result {@link CompletableFuture} will also cancel inner {@link ListenableFuture}. * Use param {@code mayInterruptIfRunning} to control whether to interrupt the thread of {@link ListenableFuture}. *
- * Note: CompletionException caused by this CancellationException is also considered cancellation. + * Note: CompletionException caused by CancellationException is also considered cancellation. *
* We encourage you to avoid using direct write methods in {@link CompletableFuture} so that the underlying
* {@link ListenableFuture} can benefit from cancel propagation.
diff --git a/cffu-core/src/test/java/io/foldright/cffu/ListenableFutureUtilsTest.java b/cffu-core/src/test/java/io/foldright/cffu/ListenableFutureUtilsTest.java
index 5ec0c364..f9a89fa9 100644
--- a/cffu-core/src/test/java/io/foldright/cffu/ListenableFutureUtilsTest.java
+++ b/cffu-core/src/test/java/io/foldright/cffu/ListenableFutureUtilsTest.java
@@ -10,7 +10,9 @@
import org.junit.jupiter.api.condition.EnabledForJreRange;
import org.junit.jupiter.api.condition.JRE;
+import java.time.Duration;
import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicBoolean;
import static io.foldright.cffu.ListenableFutureUtils.*;
import static io.foldright.test_utils.TestUtils.*;
@@ -129,6 +131,30 @@ void test_lf2cf_setCancellationExceptionToCf_cancellationAndPropagation() throws
assertThrowsExactly(CancellationException.class, cf::get);
}
+ @Test
+ void test_lf2cf_setCancellationExceptionToCf_cancellationAndPropagation_interruption() throws Exception {
+ final AtomicBoolean interrupted = new AtomicBoolean(false);
+ final ListenableFuture