better promise joining and combining

This commit is contained in:
WhatCats
2024-03-23 22:28:20 +01:00
parent ad06aa2e9a
commit 4dd3086af7
4 changed files with 84 additions and 61 deletions

View File

@@ -31,8 +31,11 @@ public interface Promise<T> {
PromiseFactory getFactory();
@Deprecated
T join(long interval, long timeout) throws TimeoutException;
T join(long timeout) throws TimeoutException;
@NotNull Promise<Void> thenRunSync(@NotNull ExceptionalRunnable task);
@NotNull Promise<Void> thenRunDelayedSync(@NotNull ExceptionalRunnable task, long delay, @NotNull TimeUnit unit);
@@ -73,6 +76,8 @@ public interface Promise<T> {
@NotNull Promise<T> logExceptions();
@NotNull Promise<T> logExceptions(@NotNull String message);
@NotNull Promise<T> addListener(@NotNull PromiseListener<T> listener);
@NotNull Promise<T> timeout(long time, @NotNull TimeUnit unit);