|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object akka.dispatch.Futures
public class Futures
Futures is the Java API for Futures and Promises
Constructor Summary | |
---|---|
Futures()
|
Method Summary | ||
---|---|---|
static
|
failed(java.lang.Throwable exception)
creates an already completed Promise with the specified exception |
|
static
|
find(java.lang.Iterable<scala.concurrent.Future<T>> futures,
Function<T,java.lang.Boolean> predicate,
scala.concurrent.ExecutionContext executor)
Returns a Future that will hold the optional result of the first Future with a result that matches the predicate |
|
static
|
firstCompletedOf(java.lang.Iterable<scala.concurrent.Future<T>> futures,
scala.concurrent.ExecutionContext executor)
Returns a Future to the result of the first future in the list that is completed |
|
static
|
fold(R zero,
java.lang.Iterable<scala.concurrent.Future<T>> futures,
Function2<R,T,R> fun,
scala.concurrent.ExecutionContext executor)
A non-blocking fold over the specified futures, with the start value of the given zero. |
|
static
|
future(java.util.concurrent.Callable<T> body,
scala.concurrent.ExecutionContext executor)
Starts an asynchronous computation and returns a Future object with the result of that computation. |
|
static
|
promise()
Creates a promise object which can be completed with a value. |
|
static
|
reduce(java.lang.Iterable<scala.concurrent.Future<T>> futures,
Function2<R,T,R> fun,
scala.concurrent.ExecutionContext executor)
Reduces the results of the supplied futures and binary function. |
|
static
|
sequence(java.lang.Iterable<scala.concurrent.Future<A>> in,
scala.concurrent.ExecutionContext executor)
Simple version of traverse(java.lang.Iterable, akka.japi.Function>, scala.concurrent.ExecutionContext) . |
|
static
|
successful(T result)
Creates an already completed Promise with the specified result |
|
static
|
traverse(java.lang.Iterable<A> in,
Function<A,scala.concurrent.Future<B>> fn,
scala.concurrent.ExecutionContext executor)
Transforms a JIterable[A] into a Future[JIterable[B} using the provided Function A ⇒ Future[B]. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Futures()
Method Detail |
---|
public static <T> scala.concurrent.Future<T> future(java.util.concurrent.Callable<T> body, scala.concurrent.ExecutionContext executor)
Future
object with the result of that computation.
The result becomes available once the asynchronous computation is completed.
body
- the asychronous computationexecutor
- the execution context on which the future is run
Future
holding the result of the computationpublic static <T> scala.concurrent.Promise<T> promise()
Promise
objectpublic static <T> scala.concurrent.Future<T> failed(java.lang.Throwable exception)
exception
- (undocumented)
public static <T> scala.concurrent.Future<T> successful(T result)
result
- (undocumented)
public static <T> scala.concurrent.Future<Option<T>> find(java.lang.Iterable<scala.concurrent.Future<T>> futures, Function<T,java.lang.Boolean> predicate, scala.concurrent.ExecutionContext executor)
futures
- (undocumented)predicate
- (undocumented)executor
- (undocumented)
public static <T> scala.concurrent.Future<T> firstCompletedOf(java.lang.Iterable<scala.concurrent.Future<T>> futures, scala.concurrent.ExecutionContext executor)
futures
- (undocumented)executor
- (undocumented)
public static <T,R> scala.concurrent.Future<R> fold(R zero, java.lang.Iterable<scala.concurrent.Future<T>> futures, Function2<R,T,R> fun, scala.concurrent.ExecutionContext executor)
zero
- (undocumented)futures
- (undocumented)fun
- (undocumented)executor
- (undocumented)
public static <T,R> scala.concurrent.Future<R> reduce(java.lang.Iterable<scala.concurrent.Future<T>> futures, Function2<R,T,R> fun, scala.concurrent.ExecutionContext executor)
futures
- (undocumented)fun
- (undocumented)executor
- (undocumented)
public static <A> scala.concurrent.Future<java.lang.Iterable<A>> sequence(java.lang.Iterable<scala.concurrent.Future<A>> in, scala.concurrent.ExecutionContext executor)
traverse(java.lang.Iterable, akka.japi.Function>, scala.concurrent.ExecutionContext)
. Transforms a JIterable[Future[A} into a Future[JIterable[A}.
Useful for reducing many Futures into a single Future.
in
- (undocumented)executor
- (undocumented)
public static <A,B> scala.concurrent.Future<java.lang.Iterable<B>> traverse(java.lang.Iterable<A> in, Function<A,scala.concurrent.Future<B>> fn, scala.concurrent.ExecutionContext executor)
in
- (undocumented)fn
- (undocumented)executor
- (undocumented)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |