Additional top-level class in compilation unit: PromiseImpl.
Future.
The underlying Executor is used to execute asynchronous handlers, e.g. via
promise.future().onComplete(...).
Promise offers static factory methods to create new promises which hasn't been fulfilled yet:
Promise#make()Executor as
argument. This gives us more control over thread creation and thread pool sizes.
The main purpose of a Promise is to complete its underlying Future. When only a single Thread
will eventually complete the Promise, we use one of these methods. Calls will throw if the Promise is already
completed.
When multiple Threads may complete our Promise, we typically use one of these methods. Calls will
gracefully return false if the Promise is already completed.
| Modifier and Type | Method and Description |
|---|---|
| public default Promise | Returns: ThisPromise.Either a value)Try. containing the result or a Try. containing an exception.Completes this |
| public default Promise | Returns: ThisPromise.Another other)Future to react on.Completes this |
| public default Executor | |
| public ExecutorService | Returns: (never)
Deprecated
Removed starting with Vavr 0.10.0, use
executor() instead.
This method is deprecated. |
| public static < The value type of a successful result. T> Promise | Returns: A failedPromise.The reason why it failed. exception)Creates a failed |
| public static < The value type of a successful result. T> Promise | |
| public default Promise | |
| public static < The value type of a successful result. T> Promise | Returns: A completedPromise which contains either a Success or a Failure.The result. result)Creates a |
| public static < The value type of a successful result. T> Promise | |
| public Future | |
| public default boolean | Returns: true, if the computation successfully finished or failed, false otherwise.Checks if this |
| public static < Result type of the T> PromisePromise. | Returns: A newPromise.Makes a |
| public static < Result type of the T> PromisePromise. | |
| public static < Component type of the T> PromisePromise. | |
| public default Promise | |
| public static < The value type of a successful result. T> Promise | Returns: A succeededPromise.The result. result)Creates a succeeded |
| public static < The value type of a successful result. T> Promise | Returns: A succeededPromise.An executor, T Executor passed to the underlying Future.The result. result)Creates a succeeded |
| public boolean | Returns: false if this Promise has already been completed, true otherwise.Either a value)Try. containing the result or a Try. containing an exception.Attempts to completes this |
| public default Promise | Returns: ThisPromise.Another other)Future to react on.Attempts to complete this |
| public default boolean | Returns: false if this Promise has already been completed, true otherwise.An exception. exception)Completes this |
| public default boolean | Returns: false if this Promise has already been completed, true otherwise.A value. value)Completes this |
| complete | back to summary |
|---|---|
| public default Promise Completes this
| |
| completeWith | back to summary |
|---|---|
| public default Promise Completes this | |
| executor | back to summary |
|---|---|
| public default Executor executor() Returns the
| |
| executorService | back to summary |
|---|---|
| public ExecutorService executorService()
Deprecated Removed starting with Vavr 0.10.0, use This method is deprecated.
THE DEFAULT IMPLEMENTATION (obtained by one of the
| |
| failed | back to summary |
|---|---|
| public static <T> Promise Creates a failed
| |
| failed | back to summary |
|---|---|
| public static <T> Promise Creates a failed
| |
| failure | back to summary |
|---|---|
| public default Promise Completes this
| |
| fromTry | back to summary |
|---|---|
| public static <T> Promise Creates a
| |
| fromTry | back to summary |
|---|---|
| public static <T> Promise Creates a
| |
| future | back to summary |
|---|---|
| public Future Returns the underlying
| |
| isCompleted | back to summary |
|---|---|
| public default boolean isCompleted() Checks if this
| |
| make | back to summary |
|---|---|
| public static <T> Promise Makes a
| |
| make | back to summary |
|---|---|
| public static <T> Promise Makes a
| |
| narrow | back to summary |
|---|---|
| public static <T> Promise Narrows a widened
| |
| success | back to summary |
|---|---|
| public default Promise Completes this
| |
| successful | back to summary |
|---|---|
| public static <T> Promise Creates a succeeded
| |
| successful | back to summary |
|---|---|
| public static <T> Promise Creates a succeeded
| |
| tryComplete | back to summary |
|---|---|
| public boolean tryComplete(Try<? extends T> value) Attempts to completes this
| |
| tryCompleteWith | back to summary |
|---|---|
| public default Promise Attempts to complete this | |
| tryFailure | back to summary |
|---|---|
| public default boolean tryFailure(Throwable exception) Completes this
| |
| trySuccess | back to summary |
|---|---|
| public default boolean trySuccess(T value) Completes this
| |