|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectplay.libs.F.Promise<A>
public static class F.Promise<A>
A promise to produce a result of type A.
| Constructor Summary | |
|---|---|
F.Promise(A a)
Create a new pure promise, that is, a promise with a constant value from the start. |
|
F.Promise(play.api.libs.concurrent.Promise<A> promise)
Create a new promise wrapping the given Scala promise |
|
| Method Summary | ||
|---|---|---|
|
flatMap(F.Function<A,F.Promise<B>> function)
Maps the result of this promise to a promise for a result of type B, and flattens that to be
a single promise for B. |
|
A |
get()
Awaits for the promise to get the result using the default timeout (5000 milliseconds). |
|
A |
get(java.lang.Long timeout)
Awaits for the promise to get the result. |
|
A |
get(java.lang.Long timeout,
java.util.concurrent.TimeUnit unit)
Awaits for the promise to get the result. |
|
play.api.libs.concurrent.Promise<A> |
getWrappedPromise()
Get the underlying Scala promise |
|
|
map(F.Function<A,B> function)
Maps this promise to a promise of type B. |
|
void |
onRedeem(F.Callback<A> action)
Perform the given action callback when the Promise is redeemed. |
|
F.Promise<A> |
recover(F.Function<java.lang.Throwable,A> function)
Wraps this promise in a promise that will handle exceptions thrown by this Promise. |
|
static
|
waitAll(F.Promise<A>... promises)
Combine the given promises into a single promise for the list of results. |
|
static
|
waitAll(java.lang.Iterable<F.Promise<A>> promises)
Combine the given promises into a single promise for the list of results. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public F.Promise(play.api.libs.concurrent.Promise<A> promise)
promise - The scala promise to wrappublic F.Promise(A a)
a - the value for the promise| Method Detail |
|---|
public static <A> F.Promise<java.util.List<A>> waitAll(F.Promise<A>... promises)
promises - The promises to combine
public static <A> F.Promise<java.util.List<A>> waitAll(java.lang.Iterable<F.Promise<A>> promises)
promises - The promises to combine
public A get()
java.lang.RuntimeException - if the calculation providing the promise threw an exception
public A get(java.lang.Long timeout,
java.util.concurrent.TimeUnit unit)
timeout - A user defined timeoutunit - timeout for timeout
java.lang.RuntimeException - if the calculation providing the promise threw an exceptionpublic A get(java.lang.Long timeout)
timeout - A user defined timeout in milliseconds
java.lang.RuntimeException - if the calculation providing the promise threw an exceptionpublic void onRedeem(F.Callback<A> action)
action callback when the Promise is redeemed.
action - The action to perform.public <B> F.Promise<B> map(F.Function<A,B> function)
B. The function function is applied as
soon as the promise is redeemed.
Exceptions thrown by function will be wrapped in RuntimeException, unless
they are RuntimeException's themselves.
function - The function to map A to B.
A to B.public F.Promise<A> recover(F.Function<java.lang.Throwable,A> function)
function will be wrapped in RuntimeException, unless
they are RuntimeException's themselves.
function - The function to handle the exception. This may, for example, convert the exception into something
of type T, or it may throw another exception, or it may do some other handling.
function throws an
exception.public <B> F.Promise<B> flatMap(F.Function<A,F.Promise<B>> function)
B, and flattens that to be
a single promise for B.
Exceptions thrown by function will be wrapped in RuntimeException, unless
they are RuntimeException's themselves.
function - The function to map A to a promise for B.
Bpublic play.api.libs.concurrent.Promise<A> getWrappedPromise()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||