See: Description
Interface | Description |
---|---|
Executable<T> |
A task that returns either a successful or failed result.
|
Executor |
Executor service used to execute work in asynchronous fashion.
|
ExecutorProvider |
Allows for creating a custom
Executor for Executors.getDefault() . |
Future<T> |
A Future that will hold the result of an asynchronous computation.
|
Promise<T> |
The Promise is the promise to deliver a value at some time in the future.
|
Class | Description |
---|---|
Executors |
Factory for creating
Executor instances. |
FutureCompanion |
Acts as a Scala type companion object for
Future . |
NamedSequenceThreadFactory |
Thread factory for providing meaningful names to the created threads.
|
PromiseCompanion |
Acts as a Scala type companion object for
Promise . |
Promise
/Future
pattern which is the way to separate the execution/job side (Promise
) from the client/receiver side (Future
). Promise
is the promise to deliver a value at some time in the future.Future
is the bearer of a value-to-be, an execution yet to be finished. Promise
/Future
pair.Executor
class for performing asynchronous computations one can let the Future
class deal with that automatically. Future.apply
or statically importing the FutureCompanion.Future
method from the companion class to the Future
. The execution path for the above example is illustrated in the picture below.import static javascalautils.concurrent.FutureCompanion.Future; Future<Integer> resultSuccess = Future(() -> 9 / 3); // The Future will at some point contain: Success(3) Future<Integer> resultFailure = Future(() -> 9 / 0); // The Future will at some point contain: Failure(ArithmeticException)
Copyright © 2015, Peter Nerg Apache License v2.0