Integrated: 8331987: Enhance stacktrace clarity for CompletableFuture CancellationException
Viktor Klang
vklang at openjdk.org
Wed May 15 18:38:07 UTC 2024
On Mon, 13 May 2024 16:41:37 GMT, Viktor Klang <vklang at openjdk.org> wrote:
> This change adds wrapping of the CancellationException produced by CompletableFuture::get() and CompletableFuture::join() to add more diagnostic information and align better with FutureTask.
>
> Running the sample code from the JBS issue in JShell will produce the following:
>
>
> jshell> java.util.concurrent.CancellationException: get
> at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:392)
> at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
> at REPL.$JShell$18.m2($JShell$18.java:10)
> at REPL.$JShell$17.m1($JShell$17.java:8)
> at REPL.$JShell$16B.lambda$main$0($JShell$16B.java:8)
> at java.base/java.lang.Thread.run(Thread.java:1575)
> Caused by: java.util.concurrent.CancellationException
> at java.base/java.util.concurrent.CompletableFuture.cancel(CompletableFuture.java:2510)
> at REPL.$JShell$16B.lambda$main$1($JShell$16B.java:11)
> ... 1 more
This pull request has now been integrated.
Changeset: 8a4315f8
Author: Viktor Klang <vklang at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/8a4315f833f3700075d65fae6bc566011c837c07
Stats: 35 lines in 3 files changed: 25 ins; 0 del; 10 mod
8331987: Enhance stacktrace clarity for CompletableFuture CancellationException
Reviewed-by: alanb, dfuchs
-------------
PR: https://git.openjdk.org/jdk/pull/19219
More information about the core-libs-dev
mailing list