Modifier and Type | Method and Description |
---|---|
static <V,E extends Exception> |
newExceptionPromise(E exception)
Returns a
Promise representing an asynchronous task which has
already failed with the provided exception. |
static <V,E extends Exception> |
newResultPromise(V result)
Returns a
Promise representing an asynchronous task which has
already succeeded with the provided result. |
static <V,E extends Exception> |
newRuntimeExceptionPromise(RuntimeException exception)
Returns a
Promise representing an asynchronous task which has
already failed with the provided runtime exception. |
static <V,E extends Exception> |
when(List<Promise<V,E>> promises)
Returns a
Promise which will be completed once all of the
provided promises have succeeded, or as soon as one of them fails. |
static <V,E extends Exception> |
when(Promise<V,E>... promises)
Returns a
Promise which will be completed once all of the
provided promises have succeeded, or as soon as one of them fails. |
public static <V,E extends Exception> Promise<V,E> newRuntimeExceptionPromise(RuntimeException exception)
Promise
representing an asynchronous task which has
already failed with the provided runtime exception. Attempts to get the result will
immediately fail, and any listeners registered against the returned
promise will be immediately invoked in the same thread as the caller.V
- The type of the task's result, or Void
if the task
does not return anything (i.e. it only has side-effects).E
- The type of the exception thrown by the task if it fails, or
NeverThrowsException
if the task cannot fail.exception
- The exception indicating why the asynchronous task has failed.Promise
representing an asynchronous task which has
already failed with the provided exception.public static <V,E extends Exception> Promise<V,E> newExceptionPromise(E exception)
Promise
representing an asynchronous task which has
already failed with the provided exception. Attempts to get the result will
immediately fail, and any listeners registered against the returned
promise will be immediately invoked in the same thread as the caller.V
- The type of the task's result, or Void
if the task
does not return anything (i.e. it only has side-effects).E
- The type of the exception thrown by the task if it fails, or
NeverThrowsException
if the task cannot fail.exception
- The exception indicating why the asynchronous task has failed.Promise
representing an asynchronous task which has
already failed with the provided exception.public static <V,E extends Exception> Promise<V,E> newResultPromise(V result)
Promise
representing an asynchronous task which has
already succeeded with the provided result. Attempts to get the result
will immediately return the result, and any listeners registered against
the returned promise will be immediately invoked in the same thread as
the caller.V
- The type of the task's result, or Void
if the task
does not return anything (i.e. it only has side-effects).E
- The type of the exception thrown by the task if it fails, or
NeverThrowsException
if the task cannot fail.result
- The result of the asynchronous task.Promise
representing an asynchronous task which has
already succeeded with the provided result.public static <V,E extends Exception> Promise<List<V>,E> when(List<Promise<V,E>> promises)
Promise
which will be completed once all of the
provided promises have succeeded, or as soon as one of them fails.V
- The type of the tasks' result, or Void
if the tasks do
not return anything (i.e. they only has side-effects).E
- The type of the exception thrown by the tasks if they fail, or
NeverThrowsException
if the tasks cannot fail.promises
- The list of tasks to be combined.Promise
which will be completed once all of the
provided promises have succeeded, or as soon as one of them
fails.@SafeVarargs public static <V,E extends Exception> Promise<List<V>,E> when(Promise<V,E>... promises)
Promise
which will be completed once all of the
provided promises have succeeded, or as soon as one of them fails.V
- The type of the tasks' result, or Void
if the tasks do
not return anything (i.e. they only has side-effects).E
- The type of the exception thrown by the tasks if they fail, or
NeverThrowsException
if the tasks cannot fail.promises
- The list of tasks to be combined.Promise
which will be completed once all of the
provided promises have succeeded, or as soon as one of them
has thrown an exception.Copyright © 2025 Open Identity Platform Community. All rights reserved.