From 8dbbc66de476138f90bd7e31f58b52cc91ab9bf6 Mon Sep 17 00:00:00 2001 From: tommyskeff Date: Tue, 7 Jan 2025 08:37:02 +0000 Subject: [PATCH] small docs improvements --- .../dev/tommyjs/futur/promise/Promise.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/futur-api/src/main/java/dev/tommyjs/futur/promise/Promise.java b/futur-api/src/main/java/dev/tommyjs/futur/promise/Promise.java index 4cbba54..13bd4b8 100644 --- a/futur-api/src/main/java/dev/tommyjs/futur/promise/Promise.java +++ b/futur-api/src/main/java/dev/tommyjs/futur/promise/Promise.java @@ -501,17 +501,8 @@ public interface Promise { } /** - * Blocks until this promise has completed, and then returns its result. - * - * @return the result of the promise - * @throws CancellationException if the promise was cancelled - * @throws CompletionException if the promise completed exceptionally - */ - @Blocking - T await(); - - /** - * Blocks until this promise has completed, and then returns its result. + * Blocks until this promise has completed, and then returns its result. This method will throw + * checked exceptions if the promise completes exceptionally or the thread is interrupted. * * @return the result of the promise * @throws CancellationException if the promise was cancelled @@ -523,7 +514,8 @@ public interface Promise { /** * Blocks until either this promise has completed or the timeout has been exceeded, and then - * returns its result, if available. + * returns its result, if available. This method will throw checked exceptions if the promise + * completes exceptionally or the thread is interrupted, or the timeout is exceeded. * * @return the result of the promise * @throws CancellationException if the promise was cancelled @@ -534,6 +526,18 @@ public interface Promise { @Blocking T get(long timeout, @NotNull TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException; + /** + * Blocks until this promise has completed, and then returns its result. This method is similar + * to {@link #get()}, but will throw unchecked exceptions instead of checked exceptions if the + * promise completes exceptionally or the thread is interrupted. + * + * @return the result of the promise + * @throws CancellationException if the promise was cancelled + * @throws CompletionException if the promise completed exceptionally + */ + @Blocking + T await(); + /** * Returns a new promise, backed by this promise, that will not propagate cancellations. This means * that if the returned promise is cancelled, the cancellation will not be propagated to this promise,