T - The type this Promise will produce as resultpublic interface Promise<T>
Future this allows a safe publication of asynchronously calculated results into another thread.| Modifier and Type | Method and Description |
|---|---|
static <T> Promise<T> |
apply()
Creates an instance of Promise.
|
void |
failure(Throwable throwable)
Completes the
Promise with an exception. |
Future<T> |
future()
Get a
Future that will hold the value once this Promise is completed. |
boolean |
isCompleted()
Check if the
Promise have been completed, with a value or an exception. |
void |
success(T object)
Completes the
Promise with a value. |
static <T> Promise<T> apply()
Promise<String> p = Promise.apply();T - The type the Promise is expected to deliverFuture<T> future()
Future that will hold the value once this Promise is completed. Promise is connected to a single Future, invoking this method multiple times will always return the same Future instance.boolean isCompleted()
Promise have been completed, with a value or an exception.true if the Promise has been completed. false otherwise.void success(T object)
Promise with a value.object - The value to complete with.IllegalStateException - Thrown if the Promise is already completed.void failure(Throwable throwable)
Promise with an exception.throwable - The Throwable to complete with.IllegalStateException - Thrown if the Promise is already completed.Copyright © 2015. All rights reserved.