Package | Description |
---|---|
javascalautils.concurrent |
Contains utilities for concurrent/asynchronous programming.
|
Modifier and Type | Method and Description |
---|---|
static <T> Future<T> |
Future.apply(ThrowableFunction0<T> function)
Allows for easy creation of asynchronous computations that will be executed in the future.
|
static <T> Future<T> |
Future.apply(ThrowableFunction0<T> function,
Executor executor)
Allows for easy creation of asynchronous computations that will be executed in the future.
|
<T> Future<T> |
Executor.execute(Callable<T> callable)
Executes the provided
Callable sometime in the future. |
<T> Future<T> |
Executor.execute(Executable<T> executable)
Executes the provided
Executable sometime in the future. |
static <T> Future<T> |
Future.failed(Throwable throwable)
Creates a failed Future with the provided Throwable.
|
Future<T> |
Future.filter(java.util.function.Predicate<T> predicate)
Creates a new
Future that will filter the successful value of this instance once it is completed. |
<R> Future<R> |
Future.flatMap(java.util.function.Function<T,Future<R>> function)
Creates a new
Future that will hold the mapped successful value of this instance once it is completed. |
static <T> Future<T> |
Future.fromTry(Try<T> result)
Creates a completed Future with the provided Try.
|
Future<T> |
Promise.future()
Get a
Future that will hold the value once this Promise is completed. |
static <T> Future<T> |
FutureCompanion.Future(Future<T> future)
Allows for converting a blocking JDK
Future into a non-blocking future. |
static <T> Future<T> |
FutureCompanion.Future(Future<T> future,
Executor executor)
Allows for converting a blocking JDK
Future into a non-blocking future. |
static <T> Future<T> |
FutureCompanion.Future(ThrowableFunction0<T> function)
Allows for easy creation of asynchronous computations that will be executed in the future.
|
static <T> Future<T> |
FutureCompanion.Future(ThrowableFunction0<T> function,
Executor executor)
Allows for easy creation of asynchronous computations that will be executed in the future.
|
<R> Future<R> |
Future.map(java.util.function.Function<T,R> function)
Creates a new
Future that will hold the mapped successful value of this instance once it is completed. |
Future<T> |
Future.recover(java.util.function.Function<Throwable,T> recoverFunction)
|
static <T> Future<java.util.stream.Stream<T>> |
Future.sequence(java.util.stream.Stream<Future<T>> stream)
Turns a Stream of Futures into a single Future containing a Stream with all the results from the Futures.
|
static <T> Future<T> |
Future.successful(T value)
Creates a successful Future with the provided value.
|
<R> Future<R> |
Future.transform(java.util.function.Function<T,R> onSuccess,
java.util.function.Function<Throwable,Throwable> onFailure)
Creates a new
Future that will hold the transformed successful value of this instance once it is completed. |
static <T,R> Future<java.util.stream.Stream<R>> |
Future.traverse(java.util.stream.Stream<T> stream,
java.util.function.Function<T,Future<R>> function)
Takes a Stream of values and applies the provided function to them in parallel resulting in a Future containing a Stream with the mapped values.
|
Modifier and Type | Method and Description |
---|---|
<T> List<Future<T>> |
Executor.executeAll(Callable<T>... callables)
Executes the list of provided
Callable sometime in the future. |
<T> List<Future<T>> |
Executor.executeAll(Executable<T>... executables)
Executes the list of provided
Executable sometime in the future. |
Modifier and Type | Method and Description |
---|---|
void |
Promise.completeWith(Future<T> future)
|
boolean |
Promise.tryCompleteWith(Future<T> future)
|
Modifier and Type | Method and Description |
---|---|
<R> Future<R> |
Future.flatMap(java.util.function.Function<T,Future<R>> function)
Creates a new
Future that will hold the mapped successful value of this instance once it is completed. |
static <T> Future<java.util.stream.Stream<T>> |
Future.sequence(java.util.stream.Stream<Future<T>> stream)
Turns a Stream of Futures into a single Future containing a Stream with all the results from the Futures.
|
static <T,R> Future<java.util.stream.Stream<R>> |
Future.traverse(java.util.stream.Stream<T> stream,
java.util.function.Function<T,Future<R>> function)
Takes a Stream of values and applies the provided function to them in parallel resulting in a Future containing a Stream with the mapped values.
|
Copyright © 2015, Peter Nerg Apache License v2.0