| Modifier and Type | Class and Description |
|---|---|
class |
Promise<T>
Promise is a Future that provides methods to set its result.
|
| Modifier and Type | Field and Description |
|---|---|
static Future<Boolean> |
Future.FALSE
A constant
false future. |
static Future<Boolean> |
Future.TRUE
A constant
true future. |
static Future<Void> |
Future.VOID
A constant void future.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> Future<T> |
Tailrec.apply(int batchSize,
java.util.function.Supplier<Future<T>> sup)
Runs the recursive future using the custom batch size.
|
static <T> Future<T> |
Tailrec.apply(java.util.function.Supplier<Future<T>> sup)
Runs the recursive future using the default batch size.
|
static <T> Future<T> |
Future.apply(java.util.function.Supplier<T> s)
Creates a future with the result of the supplier.
|
<T> Future<T> |
FuturePool.async(java.util.function.Supplier<T> s)
Isolates the execution of the supplier on this future pool.
|
<U,R> Future<R> |
Promise.biFlatMap(Future<U> other,
java.util.function.BiFunction<? super T,? super U,? extends Future<R>> f) |
<U,R> Future<R> |
Future.biFlatMap(Future<U> other,
java.util.function.BiFunction<? super T,? super U,? extends Future<R>> f)
Waits for this and other (running in parallel), maps the result with f, and flattens the result.
|
<U,R> Future<R> |
Promise.biMap(Future<U> other,
java.util.function.BiFunction<? super T,? super U,? extends R> f) |
<U,R> Future<R> |
Future.biMap(Future<U> other,
java.util.function.BiFunction<? super T,? super U,? extends R> f)
Waits for this and other (running in parallel) and then maps the result with f.
|
static <T> Future<List<T>> |
Future.collect(List<? extends Future<T>> list)
Transforms a list of futures into a future of a list.
|
protected <R> Future<R> |
Promise.continuation(io.trane.future.Continuation<T,R> c) |
static Future<Void> |
Future.delay(java.time.Duration delay,
ScheduledExecutorService scheduler)
Returns a void future that is satisfied after the specified delay.
|
Future<T> |
Promise.delayed(java.time.Duration delay,
ScheduledExecutorService scheduler) |
Future<T> |
Future.delayed(java.time.Duration delay,
ScheduledExecutorService scheduler)
Delays the result of this future.
|
static <T> Future<List<T>> |
Future.emptyList()
Returns a satisfied future with an immutable empty list.
|
static <T> Future<Optional<T>> |
Future.emptyOptional()
Returns a satisfied future with an empty optional.
|
Future<T> |
Promise.ensure(Runnable f) |
Future<T> |
Future.ensure(Runnable r)
Runs r when this future completes.
|
static <T> Future<T> |
Future.exception(Throwable ex)
Creates a failed future.
|
static <T> Future<T> |
Future.firstCompletedOf(List<Future<T>> list)
Finds the first future that completes.
|
static <T> Future<T> |
Future.flatApply(java.util.function.Supplier<Future<T>> s)
Applies the provided supplier and flattens the result.
|
<R> Future<R> |
Promise.flatMap(java.util.function.Function<? super T,? extends Future<R>> f) |
<R> Future<R> |
Future.flatMap(java.util.function.Function<? super T,? extends Future<R>> f)
Maps the result of this future to another future and flattens the result.
|
static <T> Future<T> |
Future.flatten(Future<Future<T>> fut)
Flattens a nested future.
|
Future<T> |
Promise.interruptible() |
Future<T> |
Future.interruptible()
Creates a future that will be completed with the interrupt exception if an interrupt is received.
|
<T> Future<T> |
FuturePool.isolate(java.util.function.Supplier<Future<T>> s)
Isolates the execution of a future on this future pool.
|
static <T> Future<Void> |
Future.join(List<? extends Future<T>> list)
This method is similar to collect, but it discards the result of the futures.
|
<R> Future<R> |
Promise.map(java.util.function.Function<? super T,? extends R> f) |
<R> Future<R> |
Future.map(java.util.function.Function<? super T,? extends R> f)
Maps the result of this future to another value.
|
static <T> Future<T> |
Future.never()
Returns a future that is never satisfied.
|
Future<T> |
Promise.onFailure(java.util.function.Consumer<Throwable> c) |
Future<T> |
Future.onFailure(java.util.function.Consumer<Throwable> c)
Executes the Consumer if this future completes with an exception.
|
Future<T> |
Promise.onSuccess(java.util.function.Consumer<? super T> c) |
Future<T> |
Future.onSuccess(java.util.function.Consumer<? super T> c)
Executes the Consumer if this future completes successfully.
|
Future<T> |
Promise.rescue(java.util.function.Function<Throwable,? extends Future<T>> f) |
Future<T> |
Future.rescue(java.util.function.Function<Throwable,? extends Future<T>> f)
If this future completes with an exception, applies the provided rescue function and flattens the result.
|
Future<T> |
Promise.respond(Responder<? super T> r) |
Future<T> |
Future.respond(Responder<? super T> r)
Executes the Responder once this future completes.
|
static <T> Future<Integer> |
Future.selectIndex(List<Future<T>> list)
Selects the index of the first satisfied future.
|
<R> Future<R> |
Promise.transform(Transformer<? super T,? extends R> t) |
<R> Future<R> |
Future.transform(Transformer<? super T,? extends R> t)
Maps the result of this future using the provided Transformer.
|
<R> Future<R> |
Promise.transformWith(Transformer<? super T,? extends Future<R>> t) |
<R> Future<R> |
Future.transformWith(Transformer<? super T,? extends Future<R>> t)
Maps the result of this future using a Transformer that returns another future and flattens the result.
|
default <R> Future<R> |
Future.unsafeCast()
Casts the result of this future.
|
static <T> Future<T> |
Future.value(T v)
Creates a successful future.
|
Future<Void> |
Promise.voided() |
Future<Void> |
Future.voided()
Creates a future that is satisfied with void when this future completes.
|
static <T> Future<Void> |
Future.whileDo(java.util.function.Supplier<Boolean> cond,
java.util.function.Supplier<Future<T>> f)
Executes the supplier function while the condition is valid.
|
default Future<T> |
Future.within(java.time.Duration timeout,
ScheduledExecutorService scheduler)
Creates a future that fails with a TimeoutException if this future isn’t completed within the timeout.
|
Future<T> |
Promise.within(java.time.Duration timeout,
ScheduledExecutorService scheduler,
Throwable exception) |
Future<T> |
Future.within(java.time.Duration timeout,
ScheduledExecutorService scheduler,
Throwable exception)
Creates a future that fails with a exception if this future isn’t completed within the timeout.
|
| Modifier and Type | Method and Description |
|---|---|
void |
Promise.become(Future<T> result)
Becomes another future.
|
boolean |
Promise.becomeIfEmpty(Future<T> result)
Becomes another future only if this promise is undefined.
|
<U,R> Future<R> |
Promise.biFlatMap(Future<U> other,
java.util.function.BiFunction<? super T,? super U,? extends Future<R>> f) |
<U,R> Future<R> |
Future.biFlatMap(Future<U> other,
java.util.function.BiFunction<? super T,? super U,? extends Future<R>> f)
Waits for this and other (running in parallel), maps the result with f, and flattens the result.
|
<U,R> Future<R> |
Promise.biMap(Future<U> other,
java.util.function.BiFunction<? super T,? super U,? extends R> f) |
<U,R> Future<R> |
Future.biMap(Future<U> other,
java.util.function.BiFunction<? super T,? super U,? extends R> f)
Waits for this and other (running in parallel) and then maps the result with f.
|
static <T> Future<T> |
Future.flatten(Future<Future<T>> fut)
Flattens a nested future.
|
protected io.trane.future.WaitQueue<T> |
Promise.safeFlush(Future<T> result) |
| Modifier and Type | Method and Description |
|---|---|
static <T> Future<T> |
Tailrec.apply(int batchSize,
java.util.function.Supplier<Future<T>> sup)
Runs the recursive future using the custom batch size.
|
static <T> Future<T> |
Tailrec.apply(java.util.function.Supplier<Future<T>> sup)
Runs the recursive future using the default batch size.
|
<U,R> Future<R> |
Promise.biFlatMap(Future<U> other,
java.util.function.BiFunction<? super T,? super U,? extends Future<R>> f) |
<U,R> Future<R> |
Future.biFlatMap(Future<U> other,
java.util.function.BiFunction<? super T,? super U,? extends Future<R>> f)
Waits for this and other (running in parallel), maps the result with f, and flattens the result.
|
static <T> Future<List<T>> |
Future.collect(List<? extends Future<T>> list)
Transforms a list of futures into a future of a list.
|
static <T> Future<T> |
Future.firstCompletedOf(List<Future<T>> list)
Finds the first future that completes.
|
static <T> Future<T> |
Future.flatApply(java.util.function.Supplier<Future<T>> s)
Applies the provided supplier and flattens the result.
|
<R> Future<R> |
Promise.flatMap(java.util.function.Function<? super T,? extends Future<R>> f) |
<R> Future<R> |
Future.flatMap(java.util.function.Function<? super T,? extends Future<R>> f)
Maps the result of this future to another future and flattens the result.
|
static <T> Future<T> |
Future.flatten(Future<Future<T>> fut)
Flattens a nested future.
|
<T> Future<T> |
FuturePool.isolate(java.util.function.Supplier<Future<T>> s)
Isolates the execution of a future on this future pool.
|
static <T> Future<Void> |
Future.join(List<? extends Future<T>> list)
This method is similar to collect, but it discards the result of the futures.
|
Future<T> |
Promise.rescue(java.util.function.Function<Throwable,? extends Future<T>> f) |
Future<T> |
Future.rescue(java.util.function.Function<Throwable,? extends Future<T>> f)
If this future completes with an exception, applies the provided rescue function and flattens the result.
|
static <T> Future<Integer> |
Future.selectIndex(List<Future<T>> list)
Selects the index of the first satisfied future.
|
<R> Future<R> |
Promise.transformWith(Transformer<? super T,? extends Future<R>> t) |
<R> Future<R> |
Future.transformWith(Transformer<? super T,? extends Future<R>> t)
Maps the result of this future using a Transformer that returns another future and flattens the result.
|
static <T> Future<Void> |
Future.whileDo(java.util.function.Supplier<Boolean> cond,
java.util.function.Supplier<Future<T>> f)
Executes the supplier function while the condition is valid.
|
Copyright © 2017. All Rights Reserved.