public final class Promises extends Object
Promise-s;
to wrap an arbitrary CompletionStage interface to the Promise API;
to combine several CompletionStage-s into aggregating promise.| Modifier and Type | Method and Description |
|---|---|
static <T> Promise<List<T>> |
all(boolean cancelRemaining,
CompletionStage<? extends T>... promises)
Returns a promise that is resolved successfully when all
CompletionStage-s passed as parameters
are completed normally; if any promise completed exceptionally, then resulting promise is resolved faulty
as well. |
static <T> Promise<List<T>> |
all(boolean cancelRemaining,
List<? extends CompletionStage<? extends T>> promises) |
static <K,T> Promise<Map<K,T>> |
all(boolean cancelRemaining,
Map<? extends K,? extends CompletionStage<? extends T>> promises) |
static <T> Promise<List<T>> |
all(CompletionStage<? extends T>... promises)
Returns a promise that is resolved successfully when all
CompletionStage-s passed as parameters
are completed normally; if any promise completed exceptionally, then resulting promise is resolved faulty
as well. |
static <T> Promise<List<T>> |
all(List<? extends CompletionStage<? extends T>> promises) |
static <K,T> Promise<Map<K,T>> |
all(Map<? extends K,? extends CompletionStage<? extends T>> promises) |
static <T> Promise<T> |
any(boolean cancelRemaining,
CompletionStage<? extends T>... promises)
Returns a promise that is resolved successfully when any
CompletionStage passed as parameters
is completed normally (race is possible); if all promises completed exceptionally, then resulting promise
is resolved faulty as well. |
static <T> Promise<T> |
any(boolean cancelRemaining,
List<? extends CompletionStage<? extends T>> promises) |
static <K,T> Promise<Map<K,T>> |
any(boolean cancelRemaining,
Map<? extends K,? extends CompletionStage<? extends T>> promises) |
static <T> Promise<T> |
any(CompletionStage<? extends T>... promises)
Returns a promise that is resolved successfully when any
CompletionStage passed as parameters
is completed normally (race is possible); if all promises completed exceptionally, then resulting promise
is resolved faulty as well. |
static <T> Promise<T> |
any(List<? extends CompletionStage<? extends T>> promises) |
static <K,T> Promise<Map<K,T>> |
any(Map<? extends K,? extends CompletionStage<? extends T>> promises) |
static <T> Promise<T> |
anyStrict(boolean cancelRemaining,
CompletionStage<? extends T>... promises)
Returns a promise that is resolved successfully when any
CompletionStage passed as parameters
is completed normally (race is possible); if any promise completed exceptionally before first result is
available, then resulting promise is resolved faulty as well (unlike non-Strict variant, where exceptions
are ignored if result is available at all). |
static <T> Promise<T> |
anyStrict(boolean cancelRemaining,
List<? extends CompletionStage<? extends T>> promises) |
static <K,T> Promise<Map<K,T>> |
anyStrict(boolean cancelRemaining,
Map<? extends K,? extends CompletionStage<? extends T>> promises) |
static <T> Promise<T> |
anyStrict(CompletionStage<? extends T>... promises)
Returns a promise that is resolved successfully when any
CompletionStage passed as parameters
is completed normally (race is possible); if any promise completed exceptionally before first result is
available, then resulting promise is resolved faulty as well (unlike non-Strict variant, where exceptions
are ignored if result is available at all). |
static <T> Promise<T> |
anyStrict(List<? extends CompletionStage<? extends T>> promises) |
static <K,T> Promise<Map<K,T>> |
anyStrict(Map<? extends K,? extends CompletionStage<? extends T>> promises) |
static <T> Promise<List<T>> |
atLeast(int minResultsCount,
boolean cancelRemaining,
CompletionStage<? extends T>... promises)
Generalization of the
any(CompletionStage...) method. |
static <T> Promise<List<T>> |
atLeast(int minResultsCount,
boolean cancelRemaining,
List<? extends CompletionStage<? extends T>> promises) |
static <K,T> Promise<Map<K,T>> |
atLeast(int minResultsCount,
boolean cancelRemaining,
Map<? extends K,? extends CompletionStage<? extends T>> promises) |
static <T> Promise<List<T>> |
atLeast(int minResultsCount,
CompletionStage<? extends T>... promises)
Generalization of the
any(CompletionStage...) method. |
static <T> Promise<List<T>> |
atLeast(int minResultsCount,
int maxErrorsCount,
boolean cancelRemaining,
CompletionStage<? extends T>... promises)
General method to combine several
CompletionStage-s passed as arguments into single promise. |
static <T> Promise<List<T>> |
atLeast(int minResultsCount,
int maxErrorsCount,
boolean cancelRemaining,
List<? extends CompletionStage<? extends T>> promises) |
static <K,T> Promise<Map<K,T>> |
atLeast(int minResultsCount,
int maxErrorsCount,
boolean cancelRemaining,
Map<? extends K,? extends CompletionStage<? extends T>> promises) |
static <T> Promise<List<T>> |
atLeast(int minResultsCount,
List<? extends CompletionStage<? extends T>> promises) |
static <K,T> Promise<Map<K,T>> |
atLeast(int minResultsCount,
Map<? extends K,? extends CompletionStage<? extends T>> promises) |
static <T> Promise<List<Optional<T>>> |
atLeastOrdered(int minResultsCount,
boolean cancelRemaining,
CompletionStage<? extends T>... promises) |
static <T> Promise<List<Optional<T>>> |
atLeastOrdered(int minResultsCount,
boolean cancelRemaining,
List<? extends CompletionStage<? extends T>> promises) |
static <T> Promise<List<Optional<T>>> |
atLeastOrdered(int minResultsCount,
CompletionStage<? extends T>... promises) |
static <T> Promise<List<Optional<T>>> |
atLeastOrdered(int minResultsCount,
int maxErrorsCount,
boolean cancelRemaining,
CompletionStage<? extends T>... promises) |
static <T> Promise<List<Optional<T>>> |
atLeastOrdered(int minResultsCount,
int maxErrorsCount,
boolean cancelRemaining,
List<? extends CompletionStage<? extends T>> promises) |
static <T> Promise<List<Optional<T>>> |
atLeastOrdered(int minResultsCount,
List<? extends CompletionStage<? extends T>> promises) |
static <T> Promise<List<Optional<T>>> |
atLeastOrderedStrict(int minResultsCount,
boolean cancelRemaining,
CompletionStage<? extends T>... promises) |
static <T> Promise<List<Optional<T>>> |
atLeastOrderedStrict(int minResultsCount,
boolean cancelRemaining,
List<? extends CompletionStage<? extends T>> promises) |
static <T> Promise<List<Optional<T>>> |
atLeastOrderedStrict(int minResultsCount,
CompletionStage<? extends T>... promises) |
static <T> Promise<List<Optional<T>>> |
atLeastOrderedStrict(int minResultsCount,
List<? extends CompletionStage<? extends T>> promises) |
static <T> Promise<List<T>> |
atLeastStrict(int minResultsCount,
boolean cancelRemaining,
CompletionStage<? extends T>... promises)
Generalization of the
anyStrict(CompletionStage...) method. |
static <T> Promise<List<T>> |
atLeastStrict(int minResultsCount,
boolean cancelRemaining,
List<? extends CompletionStage<? extends T>> promises) |
static <K,T> Promise<Map<K,T>> |
atLeastStrict(int minResultsCount,
boolean cancelRemaining,
Map<? extends K,? extends CompletionStage<? extends T>> promises) |
static <T> Promise<List<T>> |
atLeastStrict(int minResultsCount,
CompletionStage<? extends T>... promises)
Generalization of the
anyStrict(CompletionStage...) method. |
static <T> Promise<List<T>> |
atLeastStrict(int minResultsCount,
List<? extends CompletionStage<? extends T>> promises) |
static <K,T> Promise<Map<K,T>> |
atLeastStrict(int minResultsCount,
Map<? extends K,? extends CompletionStage<? extends T>> promises) |
static <T> Promise<T> |
failure(Throwable exception)
Method to create a faulty resolved
Promise with an exception provided |
static <T> Promise<T> |
from(CompletionStage<T> stage)
Adapts a stage passed to the
Promise API |
static <T> Promise<T> |
loop(T initialValue,
Predicate<? super T> loopCondition,
Function<? super T,? extends CompletionStage<T>> loopBody) |
static <T> Promise<T> |
maybe(Optional<T> maybeValue) |
static <T,A,R> Promise<R> |
partitioned(Iterable<? extends T> values,
int batchSize,
Function<? super T,CompletionStage<? extends T>> spawner,
Collector<T,A,R> downstream) |
static <T,A,R> Promise<R> |
partitioned(Iterable<? extends T> values,
int batchSize,
Function<? super T,CompletionStage<? extends T>> spawner,
Collector<T,A,R> downstream,
Executor downstreamExecutor) |
static <T,A,R> Promise<R> |
partitioned(Stream<? extends T> values,
int batchSize,
Function<? super T,CompletionStage<? extends T>> spawner,
Collector<T,A,R> downstream) |
static <T,A,R> Promise<R> |
partitioned(Stream<? extends T> values,
int batchSize,
Function<? super T,CompletionStage<? extends T>> spawner,
Collector<T,A,R> downstream,
Executor downstreamExecutor) |
static <T> Promise<T> |
retry(Callable<T> codeBlock,
Executor executor,
RetryPolicy<? super T> retryPolicy) |
static <T extends C,C> |
retry(RetryCallable<T,C> codeBlock,
Executor executor,
RetryPolicy<? super C> retryPolicy) |
static Promise<Void> |
retry(RetryRunnable codeBlock,
Executor executor,
RetryPolicy<? super Void> retryPolicy) |
static Promise<Void> |
retry(Runnable codeBlock,
Executor executor,
RetryPolicy<? super Void> retryPolicy) |
static <T> Promise<T> |
retryFuture(Callable<? extends CompletionStage<T>> invoker,
RetryPolicy<? super T> retryPolicy) |
static <T extends C,C> |
retryFuture(RetryCallable<? extends CompletionStage<T>,C> futureFactory,
RetryPolicy<? super C> retryPolicy) |
static <T> Promise<T> |
retryOptional(Callable<Optional<T>> codeBlock,
Executor executor,
RetryPolicy<? super T> retryPolicy) |
static <T extends C,C> |
retryOptional(RetryCallable<Optional<T>,C> codeBlock,
Executor executor,
RetryPolicy<? super C> retryPolicy) |
static <T> Promise<T> |
success(T value)
Method to create a successfully resolved
Promise with a value provided |
static <T,R extends AutoCloseable> |
tryApply(CompletionStage<R> stage,
Function<? super R,? extends T> fn) |
static <T,R extends AutoCloseable> |
tryApply(Promise<R> p,
Function<? super R,? extends T> fn) |
static <T,R extends AsyncCloseable> |
tryApplyEx(CompletionStage<R> stage,
Function<? super R,? extends T> fn) |
static <T,R extends AsyncCloseable> |
tryApplyEx(Promise<R> p,
Function<? super R,? extends T> fn) |
static <T,R extends AutoCloseable> |
tryCompose(CompletionStage<R> stage,
Function<? super R,? extends CompletionStage<T>> fn) |
static <T,R extends AutoCloseable> |
tryCompose(Promise<R> p,
Function<? super R,? extends CompletionStage<T>> fn) |
static <T,R extends AsyncCloseable> |
tryComposeEx(CompletionStage<R> stage,
Function<? super R,? extends CompletionStage<T>> fn) |
static <T,R extends AsyncCloseable> |
tryComposeEx(Promise<R> p,
Function<? super R,? extends CompletionStage<T>> fn) |
static Throwable |
unwrapCompletionException(Throwable ex) |
public static <T> Promise<T> success(T value)
Promise with a value providedT - a type of the valuevalue - a value to wrapPromise with a value providedpublic static <T> Promise<T> failure(Throwable exception)
Promise with an exception providedT - a type of the valueexception - an exception to wrapPromise with an exception providedpublic static <T> Promise<T> from(CompletionStage<T> stage)
Promise APIT - a type of the valuestage - a CompletionStage to be wrappedPromisepublic static <T> Promise<T> loop(T initialValue, Predicate<? super T> loopCondition, Function<? super T,? extends CompletionStage<T>> loopBody)
public static <T,R extends AutoCloseable> Promise<T> tryApply(CompletionStage<R> stage, Function<? super R,? extends T> fn)
public static <T,R extends AutoCloseable> Promise<T> tryApply(Promise<R> p, Function<? super R,? extends T> fn)
public static <T,R extends AsyncCloseable> Promise<T> tryApplyEx(CompletionStage<R> stage, Function<? super R,? extends T> fn)
public static <T,R extends AsyncCloseable> Promise<T> tryApplyEx(Promise<R> p, Function<? super R,? extends T> fn)
public static <T,R extends AutoCloseable> Promise<T> tryCompose(CompletionStage<R> stage, Function<? super R,? extends CompletionStage<T>> fn)
public static <T,R extends AutoCloseable> Promise<T> tryCompose(Promise<R> p, Function<? super R,? extends CompletionStage<T>> fn)
public static <T,R extends AsyncCloseable> Promise<T> tryComposeEx(CompletionStage<R> stage, Function<? super R,? extends CompletionStage<T>> fn)
public static <T,R extends AsyncCloseable> Promise<T> tryComposeEx(Promise<R> p, Function<? super R,? extends CompletionStage<T>> fn)
public static <T,A,R> Promise<R> partitioned(Iterable<? extends T> values, int batchSize, Function<? super T,CompletionStage<? extends T>> spawner, Collector<T,A,R> downstream)
public static <T,A,R> Promise<R> partitioned(Iterable<? extends T> values, int batchSize, Function<? super T,CompletionStage<? extends T>> spawner, Collector<T,A,R> downstream, Executor downstreamExecutor)
public static <T,A,R> Promise<R> partitioned(Stream<? extends T> values, int batchSize, Function<? super T,CompletionStage<? extends T>> spawner, Collector<T,A,R> downstream)
public static <T,A,R> Promise<R> partitioned(Stream<? extends T> values, int batchSize, Function<? super T,CompletionStage<? extends T>> spawner, Collector<T,A,R> downstream, Executor downstreamExecutor)
@SafeVarargs public static <T> Promise<List<T>> all(CompletionStage<? extends T>... promises)
Returns a promise that is resolved successfully when all CompletionStage-s passed as parameters
are completed normally; if any promise completed exceptionally, then resulting promise is resolved faulty
as well.
The resolved result of this promise contains a list of the resolved results of the
CompletionStage-s passed as an argument at corresponding positions.
When resulting promise is resolved faulty, all remaining incomplete CompletionStage-s are
cancelled.
T - a common supertype of the resulting valuespromises - an array of CompletionStage-s to combinepublic static <T> Promise<List<T>> all(List<? extends CompletionStage<? extends T>> promises)
public static <K,T> Promise<Map<K,T>> all(Map<? extends K,? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<List<T>> all(boolean cancelRemaining, CompletionStage<? extends T>... promises)
Returns a promise that is resolved successfully when all CompletionStage-s passed as parameters
are completed normally; if any promise completed exceptionally, then resulting promise is resolved faulty
as well.
The resolved result of this promise contains a list of the resolved results of the
CompletionStage-s passed as an argument at corresponding positions.
When resulting promise is resolved faulty and cancelRemaining parameter is
true, all remaining incomplete CompletionStage-s are cancelled.
T - a common supertype of the resulting valuescancelRemaining - when true and resulting promise is resolved faulty all incomplete CompletionStage-s are cancelledpromises - an array of CompletionStage-s to combinepublic static <T> Promise<List<T>> all(boolean cancelRemaining, List<? extends CompletionStage<? extends T>> promises)
public static <K,T> Promise<Map<K,T>> all(boolean cancelRemaining, Map<? extends K,? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<T> any(CompletionStage<? extends T>... promises)
Returns a promise that is resolved successfully when any CompletionStage passed as parameters
is completed normally (race is possible); if all promises completed exceptionally, then resulting promise
is resolved faulty as well.
The resolved result of this promise contains a value of the first resolved result of the
CompletionStage-s passed as an argument.
When resulting promise is resolved successfully, all remaining incomplete CompletionStage-s
are cancelled.
T - a common supertype of the resulting valuespromises - an array of CompletionStage-s to combinepublic static <T> Promise<T> any(List<? extends CompletionStage<? extends T>> promises)
public static <K,T> Promise<Map<K,T>> any(Map<? extends K,? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<T> any(boolean cancelRemaining, CompletionStage<? extends T>... promises)
Returns a promise that is resolved successfully when any CompletionStage passed as parameters
is completed normally (race is possible); if all promises completed exceptionally, then resulting promise
is resolved faulty as well.
The resolved result of this promise contains a value of the first resolved result of the
CompletionStage-s passed as an argument.
When resulting promise is resolved successfully and cancelRemaining parameter is
true, all remaining incomplete CompletionStage-s are cancelled.
T - a common supertype of the resulting valuescancelRemaining - when true and resulting promise is resolved faulty all incomplete CompletionStage-s are cancelledpromises - an array of CompletionStage-s to combinepublic static <T> Promise<T> any(boolean cancelRemaining, List<? extends CompletionStage<? extends T>> promises)
public static <K,T> Promise<Map<K,T>> any(boolean cancelRemaining, Map<? extends K,? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<T> anyStrict(CompletionStage<? extends T>... promises)
Returns a promise that is resolved successfully when any CompletionStage passed as parameters
is completed normally (race is possible); if any promise completed exceptionally before first result is
available, then resulting promise is resolved faulty as well (unlike non-Strict variant, where exceptions
are ignored if result is available at all).
The resolved result of this promise contains a value of the first resolved result of the
CompletionStage-s passed as an argument.
When resulting promise is resolved either successfully or faulty, all remaining incomplete
CompletionStage-s are cancelled.
Unlike other methods to combine promises (any, all, atLeast, atLeastStrict), the Promise returns
from this method reports exact exception. All other methods wrap it to MultitargetException.
T - a common supertype of the resulting valuespromises - an array of CompletionStage-s to combinepublic static <T> Promise<T> anyStrict(List<? extends CompletionStage<? extends T>> promises)
public static <K,T> Promise<Map<K,T>> anyStrict(Map<? extends K,? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<T> anyStrict(boolean cancelRemaining, CompletionStage<? extends T>... promises)
Returns a promise that is resolved successfully when any CompletionStage passed as parameters
is completed normally (race is possible); if any promise completed exceptionally before first result is
available, then resulting promise is resolved faulty as well (unlike non-Strict variant, where exceptions
are ignored if result is available at all).
The resolved result of this promise contains a value of the first resolved result of the
CompletionStage-s passed as an argument.
When resulting promise is resolved either successfully or faulty and cancelRemaining
parameter is true, all remaining incomplete CompletionStage-s are cancelled.
Unlike other methods to combine promises (any, all, atLeast, atLeastStrict), the Promise returns
from this method reports exact exception. All other methods wrap it to MultitargetException.
T - a common supertype of the resulting valuescancelRemaining - when true and resulting promise is resolved faulty all incomplete CompletionStage-s are cancelledpromises - an array of CompletionStage-s to combinepublic static <T> Promise<T> anyStrict(boolean cancelRemaining, List<? extends CompletionStage<? extends T>> promises)
public static <K,T> Promise<Map<K,T>> anyStrict(boolean cancelRemaining, Map<? extends K,? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<List<T>> atLeast(int minResultsCount, CompletionStage<? extends T>... promises)
Generalization of the any(CompletionStage...) method.
Returns a promise that is resolved successfully when at least minResultCount of
CompletionStage-s passed as parameters are completed normally (race is possible); if less than
minResultCount of promises completed normally, then resulting promise is resolved faulty.
The resolved result of this promise contains a list of the resolved results of the
CompletionStage-s passed as an argument at corresponding positions. Non-completed or completed
exceptionally promises have null values.
When resulting promise is resolved successfully, all remaining incomplete CompletionStage-s
are cancelled.
T - a common supertype of the resulting valuesminResultsCount - a minimum number of promises that should be completed normally to resolve resulting promise successfullypromises - an array of CompletionStage-s to combinepublic static <T> Promise<List<T>> atLeast(int minResultsCount, List<? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<List<Optional<T>>> atLeastOrdered(int minResultsCount, CompletionStage<? extends T>... promises)
public static <T> Promise<List<Optional<T>>> atLeastOrdered(int minResultsCount, List<? extends CompletionStage<? extends T>> promises)
public static <K,T> Promise<Map<K,T>> atLeast(int minResultsCount, Map<? extends K,? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<List<T>> atLeast(int minResultsCount, boolean cancelRemaining, CompletionStage<? extends T>... promises)
Generalization of the any(CompletionStage...) method.
Returns a promise that is resolved successfully when at least minResultCount of
CompletionStage-s passed as parameters are completed normally (race is possible); if less than
minResultCount of promises completed normally, then resulting promise is resolved faulty.
The resolved result of this promise contains a list of the resolved results of the
CompletionStage-s passed as an argument at corresponding positions. Non-completed or completed
exceptionally promises have null values.
When resulting promise is resolved successfully and cancelRemaining parameter
is true, all remaining incomplete CompletionStage-s are cancelled.
T - a common supertype of the resulting valuesminResultsCount - a minimum number of promises that should be completed normally to resolve resulting promise successfullycancelRemaining - when true and resulting promise is resolved faulty all incomplete CompletionStage-s are cancelledpromises - an array of CompletionStage-s to combinepublic static <T> Promise<List<T>> atLeast(int minResultsCount, boolean cancelRemaining, List<? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<List<Optional<T>>> atLeastOrdered(int minResultsCount, boolean cancelRemaining, CompletionStage<? extends T>... promises)
public static <T> Promise<List<Optional<T>>> atLeastOrdered(int minResultsCount, boolean cancelRemaining, List<? extends CompletionStage<? extends T>> promises)
public static <K,T> Promise<Map<K,T>> atLeast(int minResultsCount, boolean cancelRemaining, Map<? extends K,? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<List<T>> atLeastStrict(int minResultsCount, CompletionStage<? extends T>... promises)
Generalization of the anyStrict(CompletionStage...) method.
Returns a promise that is resolved successfully when at least minResultCount of
CompletionStage-s passed as parameters are completed normally (race is possible); if less than
minResultCount of promises completed normally, then resulting promise is resolved faulty.
If any promise completed exceptionally before minResultCount of results are
available, then resulting promise is resolved faulty as well.
The resolved result of this promise contains a list of the resolved results of the
CompletionStage-s passed as an argument at corresponding positions. Non-completed promises
have null values.
When resulting promise is resolved either successfully or faulty, all remaining incomplete
CompletionStage-s are cancelled.
T - a common supertype of the resulting valuesminResultsCount - a minimum number of promises that should be completed normally to resolve resulting promise successfullypromises - an array of CompletionStage-s to combinepublic static <T> Promise<List<T>> atLeastStrict(int minResultsCount, List<? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<List<Optional<T>>> atLeastOrderedStrict(int minResultsCount, CompletionStage<? extends T>... promises)
public static <T> Promise<List<Optional<T>>> atLeastOrderedStrict(int minResultsCount, List<? extends CompletionStage<? extends T>> promises)
public static <K,T> Promise<Map<K,T>> atLeastStrict(int minResultsCount, Map<? extends K,? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<List<T>> atLeastStrict(int minResultsCount, boolean cancelRemaining, CompletionStage<? extends T>... promises)
Generalization of the anyStrict(CompletionStage...) method.
Returns a promise that is resolved successfully when at least minResultCount of
CompletionStage-s passed as parameters are completed normally (race is possible); if less than
minResultCount of promises completed normally, then resulting promise is resolved faulty.
If any promise completed exceptionally before minResultCount of results are available,
then resulting promise is resolved faulty as well.
The resolved result of this promise contains a list of the resolved results of the
CompletionStage-s passed as an argument at corresponding positions. Non-completed promises have
null values.
When resulting promise is resolved either successfully or faulty and cancelRemaining
parameter is true, all remaining incomplete CompletionStage-s are cancelled.
T - a common supertype of the resulting valuesminResultsCount - a minimum number of promises that should be completed normally to resolve resulting promise successfullycancelRemaining - when true and resulting promise is resolved faulty all incomplete CompletionStage-s are cancelledpromises - an array of CompletionStage-s to combinepublic static <T> Promise<List<T>> atLeastStrict(int minResultsCount, boolean cancelRemaining, List<? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<List<Optional<T>>> atLeastOrderedStrict(int minResultsCount, boolean cancelRemaining, CompletionStage<? extends T>... promises)
public static <T> Promise<List<Optional<T>>> atLeastOrderedStrict(int minResultsCount, boolean cancelRemaining, List<? extends CompletionStage<? extends T>> promises)
public static <K,T> Promise<Map<K,T>> atLeastStrict(int minResultsCount, boolean cancelRemaining, Map<? extends K,? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<List<T>> atLeast(int minResultsCount, int maxErrorsCount, boolean cancelRemaining, CompletionStage<? extends T>... promises)
General method to combine several CompletionStage-s passed as arguments into single promise.
The resulting promise is resolved successfully when at least minResultCount of
CompletionStage-s passed as parameters are completed normally (race is possible).
If less than minResultCount of promises completed normally, then resulting promise is
resolved faulty.
If maxErrorsCount of promises completed exceptionally before minResultCount
of results are available, then resulting promise is resolved faulty as well.
The resolved result of this promise contains a list of the resolved results of the CompletionStage-s
passed as an argument at corresponding positions. Non-completed promises and promises completed exceptionally
have null values.
When resulting promise is resolved either successfully or faulty, all remaining incomplete
CompletionStage-s are cancelled if cancelRemaining parameter is true.
T - a common supertype of the resulting valuesminResultsCount - a minimum number of promises that should be completed normally to resolve resulting promise successfullymaxErrorsCount - a maximum number of promises that may be completed exceptionally before resolving resulting promise faultycancelRemaining - a flag that indicates (if true) whether or not all remaining incomplete CompletionStage-s should
be cancelled once a resulting promise outcome is known.promises - an array of CompletionStage-s to combinepublic static <T> Promise<List<T>> atLeast(int minResultsCount, int maxErrorsCount, boolean cancelRemaining, List<? extends CompletionStage<? extends T>> promises)
@SafeVarargs public static <T> Promise<List<Optional<T>>> atLeastOrdered(int minResultsCount, int maxErrorsCount, boolean cancelRemaining, CompletionStage<? extends T>... promises)
public static <T> Promise<List<Optional<T>>> atLeastOrdered(int minResultsCount, int maxErrorsCount, boolean cancelRemaining, List<? extends CompletionStage<? extends T>> promises)
public static <K,T> Promise<Map<K,T>> atLeast(int minResultsCount, int maxErrorsCount, boolean cancelRemaining, Map<? extends K,? extends CompletionStage<? extends T>> promises)
public static Promise<Void> retry(Runnable codeBlock, Executor executor, RetryPolicy<? super Void> retryPolicy)
public static Promise<Void> retry(RetryRunnable codeBlock, Executor executor, RetryPolicy<? super Void> retryPolicy)
public static <T> Promise<T> retry(Callable<T> codeBlock, Executor executor, RetryPolicy<? super T> retryPolicy)
public static <T extends C,C> Promise<T> retry(RetryCallable<T,C> codeBlock, Executor executor, RetryPolicy<? super C> retryPolicy)
public static <T> Promise<T> retryOptional(Callable<Optional<T>> codeBlock, Executor executor, RetryPolicy<? super T> retryPolicy)
public static <T extends C,C> Promise<T> retryOptional(RetryCallable<Optional<T>,C> codeBlock, Executor executor, RetryPolicy<? super C> retryPolicy)
public static <T> Promise<T> retryFuture(Callable<? extends CompletionStage<T>> invoker, RetryPolicy<? super T> retryPolicy)
public static <T extends C,C> Promise<T> retryFuture(RetryCallable<? extends CompletionStage<T>,C> futureFactory, RetryPolicy<? super C> retryPolicy)
Copyright © 2021. All rights reserved.