CompletableFuture
instead.@Deprecated 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(java.util.concurrent.CompletionStage<? extends A> other)
Deprecated.
Completes this promise with the specified Promise, once that Promise is completed.
|
F.Promise<java.lang.Void> |
completeWith(java.util.concurrent.CompletionStage<? extends A> other,
scala.concurrent.ExecutionContext ec)
Deprecated.
Completes this promise with the specified Promise, once that Promise is completed.
|
static <A> F.RedeemablePromise<A> |
empty()
Deprecated.
Creates a new Promise with no value
|
void |
failure(java.lang.Throwable t)
Deprecated.
Completes the promise with an exception
|
void |
success(A a)
Deprecated.
Completes the promise with a value.
|
F.Promise<java.lang.Boolean> |
tryCompleteWith(F.Promise<? extends A> other)
Deprecated.
Completes this promise with the specified Promise, once that Promise is completed.
|
F.Promise<java.lang.Boolean> |
tryCompleteWith(F.Promise<? extends A> other,
scala.concurrent.ExecutionContext ec)
Deprecated.
Completes this promise with the specified Promise, once that Promise is completed.
|
acceptEither, acceptEitherAsync, acceptEitherAsync, applyToEither, applyToEitherAsync, applyToEitherAsync, asScala, delayed, delayed, exceptionally, fallbackTo, filter, filter, flatMap, flatMap, get, get, handle, handleAsync, handleAsync, map, map, onFailure, onFailure, onRedeem, onRedeem, or, promise, promise, pure, recover, recover, recoverWith, recoverWith, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, sequence, sequence, sequence, sequence, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, throwing, timeout, timeout, timeout, timeout, toCompletableFuture, transform, transform, whenComplete, whenCompleteAsync, whenCompleteAsync, wrap, 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(java.util.concurrent.CompletionStage<? extends A> other)
other
- The value to complete withpublic F.Promise<java.lang.Void> completeWith(java.util.concurrent.CompletionStage<? extends A> other, scala.concurrent.ExecutionContext ec)
other
- The value to complete withec
- An execution contextpublic F.Promise<java.lang.Boolean> tryCompleteWith(F.Promise<? extends A> other)
other
- The value to complete withpublic F.Promise<java.lang.Boolean> tryCompleteWith(F.Promise<? extends A> other, scala.concurrent.ExecutionContext ec)
other
- The value to complete withec
- An execution context