|
|||||||||
| 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(scala.concurrent.Future<A> future)
Deprecated. Since 2.2. Use wrap(Future) instead. |
|
| Method Summary | ||
|---|---|---|
static
|
delayed(F.Function0<A> function,
long delay,
java.util.concurrent.TimeUnit unit)
Create a Promise which, after a delay, will be redeemed with the result of a given function. |
|
static
|
delayed(F.Function0<A> function,
long delay,
java.util.concurrent.TimeUnit unit,
scala.concurrent.ExecutionContext ec)
Create a Promise which, after a delay, will be redeemed with the result of a given function. |
|
|
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. |
|
|
flatMap(F.Function<A,F.Promise<B>> function,
scala.concurrent.ExecutionContext ec)
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()
Deprecated. Since 2.2. Use get(long, TimeUnit) or get(long) instead. |
|
A |
get(long timeout)
Awaits for the promise to get the result. |
|
A |
get(java.lang.Long timeout)
Deprecated. Since 2.2. Use { get(long) instead. |
|
A |
get(long timeout,
java.util.concurrent.TimeUnit unit)
Awaits for the promise to get the result. |
|
A |
get(java.lang.Long timeout,
java.util.concurrent.TimeUnit unit)
Deprecated. Since 2.2. Use get(long, TimeUnit) instead. |
|
scala.concurrent.Future<A> |
getWrappedPromise()
Deprecated. Since 2.2. Use wrapped() instead. |
|
|
map(F.Function<A,B> function)
Maps this promise to a promise of type B. |
|
|
map(F.Function<A,B> function,
scala.concurrent.ExecutionContext ec)
Maps this promise to a promise of type B. |
|
void |
onFailure(F.Callback<java.lang.Throwable> action)
Perform the given action callback if the promise encounters an exception. |
|
void |
onFailure(F.Callback<java.lang.Throwable> action,
scala.concurrent.ExecutionContext ec)
Perform the given action callback if the promise encounters an exception. |
|
void |
onRedeem(F.Callback<A> action)
Perform the given action callback when the Promise is redeemed. |
|
void |
onRedeem(F.Callback<A> action,
scala.concurrent.ExecutionContext ec)
Perform the given action callback when the Promise is redeemed. |
|
|
or(F.Promise<B> another)
combines the current promise with another promise using `or` |
|
static
|
promise(F.Function0<A> function)
Create a Promise which will be redeemed with the result of a given function. |
|
static
|
promise(F.Function0<A> function,
scala.concurrent.ExecutionContext ec)
Create a Promise which will be redeemed with the result of a given Function0. |
|
static
|
pure(A a)
Create a new pure promise, that is, a promise with a constant value from the start. |
|
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. |
|
F.Promise<A> |
recover(F.Function<java.lang.Throwable,A> function,
scala.concurrent.ExecutionContext ec)
Wraps this promise in a promise that will handle exceptions thrown by this Promise. |
|
static
|
sequence(scala.concurrent.ExecutionContext ec,
F.Promise<? extends A>... promises)
Combine the given promises into a single promise for the list of results. |
|
static
|
sequence(F.Promise<? extends A>... promises)
Combine the given promises into a single promise for the list of results. |
|
static
|
sequence(java.lang.Iterable<F.Promise<? extends A>> promises)
Combine the given promises into a single promise for the list of results. |
|
static
|
sequence(java.lang.Iterable<F.Promise<? extends A>> promises,
scala.concurrent.ExecutionContext ec)
Combine the given promises into a single promise for the list of results. |
|
static
|
throwing(java.lang.Throwable throwable)
Create a new promise throwing an exception. |
|
static F.Promise<scala.Unit> |
timeout()
Deprecated. Since 2.2. Use timeout(long) or timeout(long, TimeUnit) instead. |
|
static
|
timeout(A message,
long delay)
Create a Promise that is redeemed after a timeout. |
|
static
|
timeout(A message,
java.lang.Long delay)
Deprecated. Since 2.2. Use timeout(Object, long) instead. |
|
static
|
timeout(A message,
long delay,
java.util.concurrent.TimeUnit unit)
Create a Promise that is redeemed after a timeout. |
|
static
|
timeout(A message,
java.lang.Long delay,
java.util.concurrent.TimeUnit unit)
Deprecated. Since 2.2. Use timeout(Object, long, TimeUnit) instead. |
|
static
|
timeout(long delay)
Create a Promise timer that throws a TimeoutException after a given timeout. |
|
static
|
timeout(long delay,
java.util.concurrent.TimeUnit unit)
Create a Promise timer that throws a TimeoutException after a given timeout. |
|
static
|
waitAll(F.Promise<? extends A>... promises)
Deprecated. Since 2.1. Use #sequence(Promise...) instead. |
|
static
|
waitAll(java.lang.Iterable<F.Promise<? extends A>> promises)
Deprecated. Since 2.1. Use sequence(Iterable) instead. |
|
static
|
wrap(scala.concurrent.Future<A> future)
Creates a Promise that wraps a Scala Future. |
|
scala.concurrent.Future<A> |
wrapped()
Gets the Scala Future wrapped by this Promise. |
|
|
zip(F.Promise<B> another)
Zips the values of this promise with another, and creates a new promise holding the tuple of their results |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
@Deprecated public F.Promise(scala.concurrent.Future<A> future)
wrap(Future) instead.
future - The Scala Future to wrap| Method Detail |
|---|
public static <A> F.Promise<A> wrap(scala.concurrent.Future<A> future)
future - The Scala Future to wrappublic static <A> F.Promise<java.util.List<A>> sequence(F.Promise<? extends A>... promises)
promises - The promises to combine
public static <A> F.Promise<java.util.List<A>> sequence(scala.concurrent.ExecutionContext ec,
F.Promise<? extends A>... promises)
ec - Used to execute the sequencing operations.promises - The promises to combine
@Deprecated public static <A> F.Promise<java.util.List<A>> waitAll(F.Promise<? extends A>... promises)
#sequence(Promise...) instead.
promises - The promises to combine
public static <A> F.Promise<A> timeout(A message,
long delay,
java.util.concurrent.TimeUnit unit)
message - The message to use to redeem the Promise.delay - The delay (expressed with the corresponding unit).unit - The Unit.
@Deprecated
public static <A> F.Promise<A> timeout(A message,
java.lang.Long delay,
java.util.concurrent.TimeUnit unit)
timeout(Object, long, TimeUnit) instead.
message - The message to use to redeem the Promise.delay - The delay (expressed with the corresponding unit).unit - The Unit.
@Deprecated
public static F.Promise<scala.Unit> timeout()
throws java.util.concurrent.TimeoutException
timeout(long) or timeout(long, TimeUnit) instead.
java.util.concurrent.TimeoutException
public static <A> F.Promise<A> timeout(A message,
long delay)
message - The message to use to redeem the Promise.delay - The delay expressed in milliseconds.
@Deprecated
public static <A> F.Promise<A> timeout(A message,
java.lang.Long delay)
timeout(Object, long) instead.
message - The message to use to redeem the Promise.delay - The delay expressed in milliseconds.public static <A> F.Promise<scala.Unit> timeout(long delay)
delay - The delay expressed in milliseconds.
public static <A> F.Promise<scala.Unit> timeout(long delay,
java.util.concurrent.TimeUnit unit)
delay - The delay (expressed with the corresponding unit).unit - The Unit.
public static <A> F.Promise<java.util.List<A>> sequence(java.lang.Iterable<F.Promise<? extends A>> promises)
promises - The promises to combine
public static <A> F.Promise<java.util.List<A>> sequence(java.lang.Iterable<F.Promise<? extends A>> promises,
scala.concurrent.ExecutionContext ec)
promises - The promises to combineec - Used to execute the sequencing operations.
@Deprecated public static <A> F.Promise<java.util.List<A>> waitAll(java.lang.Iterable<F.Promise<? extends A>> promises)
sequence(Iterable) instead.
promises - The promises to combine
public static <A> F.Promise<A> pure(A a)
a - the value for the promisepublic static <A> F.Promise<A> throwing(java.lang.Throwable throwable)
throwable - Value to throwpublic static <A> F.Promise<A> promise(F.Function0<A> function)
function - Used to fulfill the Promise.
public static <A> F.Promise<A> promise(F.Function0<A> function,
scala.concurrent.ExecutionContext ec)
function - Used to fulfill the Promise.ec - The ExecutionContext to run the function in.
public static <A> F.Promise<A> delayed(F.Function0<A> function,
long delay,
java.util.concurrent.TimeUnit unit)
function - The function to call to fulfill the Promise.delay - The time to wait.unit - The units to use for the delay.
public static <A> F.Promise<A> delayed(F.Function0<A> function,
long delay,
java.util.concurrent.TimeUnit unit,
scala.concurrent.ExecutionContext ec)
function - The function to call to fulfill the Promise.delay - The time to wait.unit - The units to use for the delay.ec - The ExecutionContext to run the Function0 in.@Deprecated public A get()
get(long, TimeUnit) or get(long) instead.
@Deprecated
public A get(java.lang.Long timeout,
java.util.concurrent.TimeUnit unit)
get(long, TimeUnit) instead.
timeout - A user defined timeoutunit - timeout for timeout
public A get(long timeout,
java.util.concurrent.TimeUnit unit)
timeout - A user defined timeoutunit - timeout for timeout
@Deprecated public A get(java.lang.Long timeout)
get(long) instead.
timeout - A user defined timeout in milliseconds
public A get(long timeout)
timeout - A user defined timeout in milliseconds
public <B> F.Promise<F.Either<A,B>> or(F.Promise<B> another)
another promise using `or`
another - public void onRedeem(F.Callback<A> action)
action callback when the Promise is redeemed.
The callback will be run in the default execution context.
action - The action to perform.
public void onRedeem(F.Callback<A> action,
scala.concurrent.ExecutionContext ec)
action callback when the Promise is redeemed.
action - The action to perform.ec - The ExecutionContext to execute the action in.public <B> F.Promise<B> map(F.Function<A,B> function)
B. The function function is applied as
soon as the promise is redeemed.
The function will be run in the default execution context.
function - The function to map A to B.
A to B.
public <B> F.Promise<B> map(F.Function<A,B> function,
scala.concurrent.ExecutionContext ec)
B. The function function is applied as
soon as the promise is redeemed.
function - The function to map A to B.ec - The ExecutionContext to execute the function in.
A to B.public F.Promise<A> recover(F.Function<java.lang.Throwable,A> function)
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 F.Promise<A> recover(F.Function<java.lang.Throwable,A> function,
scala.concurrent.ExecutionContext ec)
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.ec - The ExecutionContext to execute the function in.
function throws an
exception.public void onFailure(F.Callback<java.lang.Throwable> action)
action callback if the promise encounters an exception.
This action will be run in the default exceution context.
action - The action to perform.
public void onFailure(F.Callback<java.lang.Throwable> action,
scala.concurrent.ExecutionContext ec)
action callback if the promise encounters an exception.
action - The action to perform.ec - The ExecutionContext to execute the callback in.public <B> F.Promise<B> flatMap(F.Function<A,F.Promise<B>> function)
B, and flattens that to be
a single promise for B.
The function will be run in the default execution context.
function - The function to map A to a promise for B.
B
public <B> F.Promise<B> flatMap(F.Function<A,F.Promise<B>> function,
scala.concurrent.ExecutionContext ec)
B, and flattens that to be
a single promise for B.
function - The function to map A to a promise for B.ec - The ExecutionContext to execute the function in.
Bpublic <B> F.Promise<F.Tuple<A,B>> zip(F.Promise<B> another)
another, and creates a new promise holding the tuple of their results
another - public scala.concurrent.Future<A> wrapped()
@Deprecated public scala.concurrent.Future<A> getWrappedPromise()
wrapped() instead.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||