public static class F.RedeemablePromise<A> extends F.Promise<A>
RedeemablePromise<Integer> someFutureInt = RedeemablePromise.empty();
someFutureInt.map(new Function<Integer, Result>() {
public Result apply(Integer i) {
// This would apply once the redeemable promise succeed
return Results.ok("" + i);
}
});
// In another thread, you now may complete the RedeemablePromise.
someFutureInt.success(42);
Modifier and Type | Method and Description |
---|---|
F.Promise<java.lang.Void> |
completeWith(F.Promise other)
Completes this promise with the specified Promise, once that Promise is completed.
|
F.Promise<java.lang.Void> |
completeWith(F.Promise other,
scala.concurrent.ExecutionContext ec)
Completes this promise with the specified Promise, once that Promise is completed.
|
static <A> F.RedeemablePromise<A> |
empty()
Creates a new Promise with no value
|
void |
failure(java.lang.Throwable t)
Completes the promise with an exception
|
void |
success(A a)
Completes the promise with a value.
|
F.Promise<java.lang.Boolean> |
tryCompleteWith(F.Promise other)
Completes this promise with the specified Promise, once that Promise is completed.
|
F.Promise<java.lang.Boolean> |
tryCompleteWith(F.Promise other,
scala.concurrent.ExecutionContext ec)
Completes this promise with the specified Promise, once that Promise is completed.
|
delayed, delayed, fallbackTo, filter, filter, flatMap, flatMap, get, get, map, map, onFailure, onFailure, onRedeem, onRedeem, or, promise, promise, pure, recover, recover, recoverWith, recoverWith, sequence, sequence, sequence, sequence, throwing, timeout, timeout, timeout, timeout, transform, transform, wrap, wrapped, zip
public static <A> F.RedeemablePromise<A> empty()
public void success(A a)
a
- The value to complete withpublic void failure(java.lang.Throwable t)
t
- The exception to fail the promise withpublic F.Promise<java.lang.Void> completeWith(F.Promise other)
other
- The value to complete withpublic F.Promise<java.lang.Void> completeWith(F.Promise other, scala.concurrent.ExecutionContext ec)
other
- The value to complete withec
- An execution contextpublic F.Promise<java.lang.Boolean> tryCompleteWith(F.Promise other)
other
- The value to complete withpublic F.Promise<java.lang.Boolean> tryCompleteWith(F.Promise other, scala.concurrent.ExecutionContext ec)
other
- The value to complete withec
- An execution context