Package org.apache.pekko.dispatch
Class Futures$
java.lang.Object
org.apache.pekko.dispatch.Futures$
Futures is the Java API for Futures and Promises
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> CompletionStage<T>asJava(scala.concurrent.Future<T> future) Convert a Scala Future to a Java CompletionStage.<T> scala.concurrent.Future<T>creates an already completed Promise with the specified exception<T> CompletionStage<T>Deprecated.Use `CompletableFuture#failedStage` instead.<T> scala.concurrent.Future<T>Starts an asynchronous computation and returns aFutureobject with the result of that computation.<T> scala.concurrent.Promise<T>promise()Creates a promise object which can be completed with a value.<T> scala.concurrent.Future<T>successful(T result) Creates an already completed Promise with the specified result
-
Field Details
-
MODULE$
Static reference to the singleton instance of this Scala object.
-
-
Constructor Details
-
Futures$
public Futures$()
-
-
Method Details
-
asJava
Convert a Scala Future to a Java CompletionStage.- Since:
- 1.2.0
-
future
public <T> scala.concurrent.Future<T> future(Callable<T> body, scala.concurrent.ExecutionContext executor) Starts an asynchronous computation and returns aFutureobject with the result of that computation.The result becomes available once the asynchronous computation is completed.
- Parameters:
body- the asynchronous computationexecutor- the execution context on which the future is run- Returns:
- the
Futureholding the result of the computation
-
promise
public <T> scala.concurrent.Promise<T> promise()Creates a promise object which can be completed with a value.- Returns:
- the newly created
Promiseobject
-
failed
creates an already completed Promise with the specified exception -
successful
public <T> scala.concurrent.Future<T> successful(T result) Creates an already completed Promise with the specified result -
failedCompletionStage
Deprecated.Use `CompletableFuture#failedStage` instead. Since 2.0.0.Creates an already completed CompletionStage with the specified exception
-