Interface DeferredManager
- All Known Implementing Classes:
AbstractDeferredManager, DefaultDeferredManager
public interface DeferredManager
DeferredManager is especially useful when dealing with asynchronous
tasks, either Runnable or Callable objects.
It's also very useful when you need to get callbacks from multiple
Promise objects.
DeferredManager dm = new DefaultDeferredManager();
Promise p1, p2, p3;
// p1 = ...; p2 = ...; p3 = ...;
dm.when(p1, p2, p3)
.done(new DoneCallback() { ... })
.fail(new FailCallback() { ... })
.progress(new ProgressCallback() { ... })
When dealing with async threads:
dm.when(new Callable() { ... }, new Callable() { ... })
.done(new DoneCallback() { ... })
.fail(new FailCallback() { ... })
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionrace(DeferredCallable<?, ?> callableV1, DeferredCallable<?, ?> callableV2, DeferredCallable<?, ?>... callables) race(DeferredFutureTask<?, ?> taskV1, DeferredFutureTask<?, ?> taskV2, DeferredFutureTask<?, ?>... tasks) race(DeferredRunnable<?> runnableV1, DeferredRunnable<?> runnableV2, DeferredRunnable<?>... runnables) <D,F, P> Promise <D, F, P> reject(F reject) A convenience method to create aPromisethat immediately fails with a reason.<D,F, P> Promise <D, F, P> resolve(D resolve) A convenience method create aPromisethat immediately resolves to a value.settle(DeferredCallable<?, ?> callableV1, DeferredCallable<?, ?> callableV2, DeferredCallable<?, ?>... callables) settle(DeferredFutureTask<?, ?> taskV1, DeferredFutureTask<?, ?> taskV2, DeferredFutureTask<?, ?>... tasks) settle(DeferredRunnable<?> runnableV1, DeferredRunnable<?> runnableV2, DeferredRunnable<?>... runnables) Accept an iterable of a variety of different object types, and convert it into corresponding Promise.WrapsRunnablewithDeferredFutureTask.WrapsRunnablewithDeferredFutureTaskWrapsCallablewithDeferredFutureTask<V1,V2> Promise <MultipleResults2<V1, V2>, OneReject<Throwable>, MasterProgress> Submits 2Callables returns a combinedPromise.<V1,V2, V3> Promise <MultipleResults3<V1, V2, V3>, OneReject<Throwable>, MasterProgress> Submits 3Callables returns a combinedPromise.<V1,V2, V3, V4>
Promise<MultipleResults4<V1, V2, V3, V4>, OneReject<Throwable>, MasterProgress> when(Callable<V1> callableV1, Callable<V2> callableV2, Callable<V3> callableV3, Callable<V4> callableV4) Submits 4Callables returns a combinedPromise.<V1,V2, V3, V4, V5>
Promise<MultipleResults5<V1, V2, V3, V4, V5>, OneReject<Throwable>, MasterProgress> when(Callable<V1> callableV1, Callable<V2> callableV2, Callable<V3> callableV3, Callable<V4> callableV4, Callable<V5> callableV5) Submits 5Callables returns a combinedPromise.<V1,V2, V3, V4, V5>
Promise<MultipleResultsN<V1, V2, V3, V4, V5>, OneReject<Throwable>, MasterProgress> when(Callable<V1> callableV1, Callable<V2> callableV2, Callable<V3> callableV3, Callable<V4> callableV4, Callable<V5> callableV5, Callable<?> callable6, Callable<?>... callables) WrapsFutureand waits forFuture.get()to return a result in the background.<V1,V2> Promise <MultipleResults2<V1, V2>, OneReject<Throwable>, MasterProgress> Submits 2Futures returns a combinedPromise.<V1,V2, V3> Promise <MultipleResults3<V1, V2, V3>, OneReject<Throwable>, MasterProgress> Submits 3Futures returns a combinedPromise.<V1,V2, V3, V4>
Promise<MultipleResults4<V1, V2, V3, V4>, OneReject<Throwable>, MasterProgress> Submits 4Futures returns a combinedPromise.<V1,V2, V3, V4, V5>
Promise<MultipleResults5<V1, V2, V3, V4, V5>, OneReject<Throwable>, MasterProgress> when(Future<V1> futureV1, Future<V2> futureV2, Future<V3> futureV3, Future<V4> futureV4, Future<V5> futureV5) Submits 5Futures returns a combinedPromise.<V1,V2, V3, V4, V5>
Promise<MultipleResultsN<V1, V2, V3, V4, V5>, OneReject<Throwable>, MasterProgress> when(Future<V1> futureV1, Future<V2> futureV2, Future<V3> futureV3, Future<V4> futureV4, Future<V5> futureV5, Future<?> future6, Future<?>... futures) when(DeferredCallable<D, P> callable) WrapsDeferredCallablewithDeferredFutureTask<V1,V2> Promise <MultipleResults2<V1, V2>, OneReject<Throwable>, MasterProgress> when(DeferredCallable<V1, ?> callableV1, DeferredCallable<V2, ?> callableV2) Submits 2DeferredCallables returns a combinedPromise.<V1,V2, V3> Promise <MultipleResults3<V1, V2, V3>, OneReject<Throwable>, MasterProgress> when(DeferredCallable<V1, ?> callableV1, DeferredCallable<V2, ?> callableV2, DeferredCallable<V3, ?> callableV3) Submits 3DeferredCallables returns a combinedPromise.<V1,V2, V3, V4>
Promise<MultipleResults4<V1, V2, V3, V4>, OneReject<Throwable>, MasterProgress> when(DeferredCallable<V1, ?> callableV1, DeferredCallable<V2, ?> callableV2, DeferredCallable<V3, ?> callableV3, DeferredCallable<V4, ?> callableV4) Submits 4DeferredCallables returns a combinedPromise.<V1,V2, V3, V4, V5>
Promise<MultipleResults5<V1, V2, V3, V4, V5>, OneReject<Throwable>, MasterProgress> when(DeferredCallable<V1, ?> callableV1, DeferredCallable<V2, ?> callableV2, DeferredCallable<V3, ?> callableV3, DeferredCallable<V4, ?> callableV4, DeferredCallable<V5, ?> callableV5) Submits 5DeferredCallables returns a combinedPromise.<V1,V2, V3, V4, V5>
Promise<MultipleResultsN<V1, V2, V3, V4, V5>, OneReject<Throwable>, MasterProgress> when(DeferredCallable<V1, ?> callableV1, DeferredCallable<V2, ?> callableV2, DeferredCallable<V3, ?> callableV3, DeferredCallable<V4, ?> callableV4, DeferredCallable<V5, ?> callableV5, DeferredCallable<?, ?> callable6, DeferredCallable<?, ?>... callables) when(DeferredFutureTask<D, P> task) May or may not submitDeferredFutureTaskfor execution.<V1,V2> Promise <MultipleResults2<V1, V2>, OneReject<Throwable>, MasterProgress> when(DeferredFutureTask<V1, ?> taskV1, DeferredFutureTask<V2, ?> taskV2) Submits 2DeferredFutureTasks returns a combinedPromise.<V1,V2, V3> Promise <MultipleResults3<V1, V2, V3>, OneReject<Throwable>, MasterProgress> when(DeferredFutureTask<V1, ?> taskV1, DeferredFutureTask<V2, ?> taskV2, DeferredFutureTask<V3, ?> taskV3) Submits 3DeferredFutureTasks returns a combinedPromise.<V1,V2, V3, V4>
Promise<MultipleResults4<V1, V2, V3, V4>, OneReject<Throwable>, MasterProgress> when(DeferredFutureTask<V1, ?> taskV1, DeferredFutureTask<V2, ?> taskV2, DeferredFutureTask<V3, ?> taskV3, DeferredFutureTask<V4, ?> taskV4) Submits 4DeferredFutureTasks returns a combinedPromise.<V1,V2, V3, V4, V5>
Promise<MultipleResults5<V1, V2, V3, V4, V5>, OneReject<Throwable>, MasterProgress> when(DeferredFutureTask<V1, ?> taskV1, DeferredFutureTask<V2, ?> taskV2, DeferredFutureTask<V3, ?> taskV3, DeferredFutureTask<V4, ?> taskV4, DeferredFutureTask<V5, ?> taskV5) Submits 5DeferredFutureTasks returns a combinedPromise.<V1,V2, V3, V4, V5>
Promise<MultipleResultsN<V1, V2, V3, V4, V5>, OneReject<Throwable>, MasterProgress> when(DeferredFutureTask<V1, ?> taskV1, DeferredFutureTask<V2, ?> taskV2, DeferredFutureTask<V3, ?> taskV3, DeferredFutureTask<V4, ?> taskV4, DeferredFutureTask<V5, ?> taskV5, DeferredFutureTask<?, ?> task6, DeferredFutureTask<?, ?>... tasks) when(DeferredRunnable<P> runnable) WrapsDeferredRunnablewithDeferredFutureTask<P1,P2> Promise <MultipleResults2<Void, Void>, OneReject<Throwable>, MasterProgress> when(DeferredRunnable<P1> runnableP1, DeferredRunnable<P2> runnableP2) Submits 2DeferredRunnables returns a combinedPromise.<P1,P2, P3> Promise <MultipleResults3<Void, Void, Void>, OneReject<Throwable>, MasterProgress> when(DeferredRunnable<P1> runnableP1, DeferredRunnable<P2> runnableP2, DeferredRunnable<P3> runnableP3) Submits 3DeferredRunnables returns a combinedPromise.<P1,P2, P3, P4>
Promise<MultipleResults4<Void, Void, Void, Void>, OneReject<Throwable>, MasterProgress> when(DeferredRunnable<P1> runnableP1, DeferredRunnable<P2> runnableP2, DeferredRunnable<P3> runnableP3, DeferredRunnable<P4> runnableP4) Submits 4DeferredRunnables returns a combinedPromise.<P1,P2, P3, P4, P5>
Promise<MultipleResults5<Void, Void, Void, Void, Void>, OneReject<Throwable>, MasterProgress> when(DeferredRunnable<P1> runnableP1, DeferredRunnable<P2> runnableP2, DeferredRunnable<P3> runnableP3, DeferredRunnable<P4> runnableP4, DeferredRunnable<P5> runnableP5) Submits 5DeferredRunnables returns a combinedPromise.<P1,P2, P3, P4, P5>
Promise<MultipleResultsN<Void, Void, Void, Void, Void>, OneReject<Throwable>, MasterProgress> when(DeferredRunnable<P1> runnableP1, DeferredRunnable<P2> runnableP2, DeferredRunnable<P3> runnableP3, DeferredRunnable<P4> runnableP4, DeferredRunnable<P5> runnableP5, DeferredRunnable<?> runnable6, DeferredRunnable<?>... runnables) <D,F, P> Promise <D, F, P> Simply returns the promise.<F,V1, V2> Promise <MultipleResults2<V1, V2>, OneReject<F>, MasterProgress> Submits 2Promises returns a combinedPromise.<F,V1, V2, V3>
Promise<MultipleResults3<V1, V2, V3>, OneReject<F>, MasterProgress> Submits 3Promises returns a combinedPromise.<F,V1, V2, V3, V4>
Promise<MultipleResults4<V1, V2, V3, V4>, OneReject<F>, MasterProgress> when(Promise<V1, ?, ?> promiseV1, Promise<V2, ?, ?> promiseV2, Promise<V3, ?, ?> promiseV3, Promise<V4, ?, ?> promiseV4) Submits 4Promises returns a combinedPromise.<F,V1, V2, V3, V4, V5>
Promise<MultipleResults5<V1, V2, V3, V4, V5>, OneReject<F>, MasterProgress> when(Promise<V1, ?, ?> promiseV1, Promise<V2, ?, ?> promiseV2, Promise<V3, ?, ?> promiseV3, Promise<V4, ?, ?> promiseV4, Promise<V5, ?, ?> promiseV5) Submits 5Promises returns a combinedPromise.<F,V1, V2, V3, V4, V5>
Promise<MultipleResultsN<V1, V2, V3, V4, V5>, OneReject<F>, MasterProgress> when(Promise<V1, ?, ?> promiseV1, Promise<V2, ?, ?> promiseV2, Promise<V3, ?, ?> promiseV3, Promise<V4, ?, ?> promiseV4, Promise<V5, ?, ?> promiseV5, Promise<?, ?, ?> promise6, Promise<?, ?, ?>... promises)
-
Method Details
-
when
-
when
WrapsRunnablewithDeferredFutureTask.- Parameters:
runnable-- Returns:
when(DeferredFutureTask)- See Also:
-
when
WrapsCallablewithDeferredFutureTask- Parameters:
callable-- Returns:
when(DeferredFutureTask)- See Also:
-
when
WrapsFutureand waits forFuture.get()to return a result in the background.- Parameters:
future-- Returns:
when(Callable)
-
when
WrapsDeferredRunnablewithDeferredFutureTask- Parameters:
runnable-- Returns:
when(DeferredFutureTask)- See Also:
-
when
WrapsDeferredCallablewithDeferredFutureTask- Parameters:
callable-- Returns:
when(DeferredFutureTask)- See Also:
-
when
May or may not submitDeferredFutureTaskfor execution. See implementation documentation.- Parameters:
task-- Returns:
DeferredFutureTask.promise()
-
when
<F,V1, Promise<MultipleResults2<V1,V2> V2>, OneReject<F>, MasterProgress> when(Promise<V1, ?, ?> promiseV1, Promise<V2, ?, ?> promiseV2) Submits 2Promises returns a combinedPromise. The combined promise signalsfailas soon as any of the promises rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
F- the common type the promises may rejectV1- the resolve type of the first promiseV2- the resolve type of the second promise- Parameters:
promiseV1- the first promise to be resolvedpromiseV2- the second promise to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<F,V1, Promise<MultipleResults3<V1,V2, V3> V2, whenV3>, OneReject<F>, MasterProgress> (Promise<V1, ?, ?> promiseV1, Promise<V2, ?, ?> promiseV2, Promise<V3, ?, ?> promiseV3) Submits 3Promises returns a combinedPromise. The combined promise signalsfailas soon as any of the promises rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
F- the common type the promises may rejectV1- the resolve type of the first promiseV2- the resolve type of the second promiseV3- the resolve type of the third promise- Parameters:
promiseV1- the first promise to be resolvedpromiseV2- the second promise to be resolvedpromiseV3- the third promise to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<F,V1, Promise<MultipleResults4<V1,V2, V3, V4> V2, whenV3, V4>, OneReject<F>, MasterProgress> (Promise<V1, ?, ?> promiseV1, Promise<V2, ?, ?> promiseV2, Promise<V3, ?, ?> promiseV3, Promise<V4, ?, ?> promiseV4) Submits 4Promises returns a combinedPromise. The combined promise signalsfailas soon as any of the promises rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
F- the common type the promises may rejectV1- the resolve type of the first promiseV2- the resolve type of the second promiseV3- the resolve type of the third promiseV4- the resolve type of the fourth promise- Parameters:
promiseV1- the first promise to be resolvedpromiseV2- the second promise to be resolvedpromiseV3- the third promise to be resolvedpromiseV4- the fourth promise to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<F,V1, Promise<MultipleResults5<V1,V2, V3, V4, V5> V2, whenV3, V4, V5>, OneReject<F>, MasterProgress> (Promise<V1, ?, ?> promiseV1, Promise<V2, ?, ?> promiseV2, Promise<V3, ?, ?> promiseV3, Promise<V4, ?, ?> promiseV4, Promise<V5, ?, ?> promiseV5) Submits 5Promises returns a combinedPromise. The combined promise signalsfailas soon as any of the promises rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
F- the common type the promises may rejectV1- the resolve type of the first promiseV2- the resolve type of the second promiseV3- the resolve type of the third promiseV4- the resolve type of the fourth promiseV5- the resolve type of the fifth promise- Parameters:
promiseV1- the first promise to be resolvedpromiseV2- the second promise to be resolvedpromiseV3- the third promise to be resolvedpromiseV4- the fourth promise to be resolvedpromiseV5- the fifth promise to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<F,V1, Promise<MultipleResultsN<V1,V2, V3, V4, V5> V2, whenV3, V4, V5>, OneReject<F>, MasterProgress> (Promise<V1, ?, ?> promiseV1, Promise<V2, ?, ?> promiseV2, Promise<V3, ?, ?> promiseV3, Promise<V4, ?, ?> promiseV4, Promise<V5, ?, ?> promiseV5, Promise<?, ?, ?> promise6, Promise<?, ?, ?>... promises) SubmitsNPromises returns a combinedPromise. The combined promise signalsfailas soon as any of the promises rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
F- the common type the promises may rejectV1- the resolve type of the first promiseV2- the resolve type of the second promiseV3- the resolve type of the third promiseV4- the resolve type of the fourth promiseV5- the resolve type of the fifth promise- Parameters:
promiseV1- the first promise to be resolvedpromiseV2- the second promise to be resolvedpromiseV3- the third promise to be resolvedpromiseV4- the fourth promise to be resolvedpromiseV5- the fifth promise to be resolvedpromises- additional promises to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
Promise<MultipleResults, OneReject<Throwable>, MasterProgress> when(Runnable runnable1, Runnable runnable2, Runnable... runnables) WrapsRunnablewithDeferredFutureTask- Parameters:
runnable1- the first runnablerunnable2- the second runnablerunnables- additional runnables- See Also:
-
when
<V1,V2> Promise<MultipleResults2<V1,V2>, OneReject<Throwable>, MasterProgress> when(Callable<V1> callableV1, Callable<V2> callableV2) Submits 2Callables returns a combinedPromise. The combined promise signalsfailas soon as any of the callables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first callableV2- the resolve type of the second callable- Parameters:
callableV1- the first callable to be resolvedcallableV2- the second callable to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResults3<V1,V3> V2, whenV3>, OneReject<Throwable>, MasterProgress> (Callable<V1> callableV1, Callable<V2> callableV2, Callable<V3> callableV3) Submits 3Callables returns a combinedPromise. The combined promise signalsfailas soon as any of the callables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first callableV2- the resolve type of the second callableV3- the resolve type of the third callable- Parameters:
callableV1- the first callable to be resolvedcallableV2- the second callable to be resolvedcallableV3- the third callable to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResults4<V1,V3, V4> V2, whenV3, V4>, OneReject<Throwable>, MasterProgress> (Callable<V1> callableV1, Callable<V2> callableV2, Callable<V3> callableV3, Callable<V4> callableV4) Submits 4Callables returns a combinedPromise. The combined promise signalsfailas soon as any of the callables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first callableV2- the resolve type of the second callableV3- the resolve type of the third callableV4- the resolve type of the fourth callable- Parameters:
callableV1- the first callable to be resolvedcallableV2- the second callable to be resolvedcallableV3- the third callable to be resolvedcallableV4- the fourth callable to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResults5<V1,V3, V4, V5> V2, whenV3, V4, V5>, OneReject<Throwable>, MasterProgress> (Callable<V1> callableV1, Callable<V2> callableV2, Callable<V3> callableV3, Callable<V4> callableV4, Callable<V5> callableV5) Submits 5Callables returns a combinedPromise. The combined promise signalsfailas soon as any of the callables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first callableV2- the resolve type of the second callableV3- the resolve type of the third callableV4- the resolve type of the fourth callableV5- the resolve type of the fifth callable- Parameters:
callableV1- the first callable to be resolvedcallableV2- the second callable to be resolvedcallableV3- the third callable to be resolvedcallableV4- the fourth callable to be resolvedcallableV5- the fifth callable to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResultsN<V1,V3, V4, V5> V2, whenV3, V4, V5>, OneReject<Throwable>, MasterProgress> (Callable<V1> callableV1, Callable<V2> callableV2, Callable<V3> callableV3, Callable<V4> callableV4, Callable<V5> callableV5, Callable<?> callable6, Callable<?>... callables) SubmitsNCallables returns a combinedPromise. The combined promise signalsfailas soon as any of the callables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first callableV2- the resolve type of the second callableV3- the resolve type of the third callableV4- the resolve type of the fourth callableV5- the resolve type of the fifth callable- Parameters:
callableV1- the first callable to be resolvedcallableV2- the second callable to be resolvedcallableV3- the third callable to be resolvedcallableV4- the fourth callable to be resolvedcallableV5- the fifth callable to be resolvedcallables- additional callables to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<P1,P2> Promise<MultipleResults2<Void,Void>, OneReject<Throwable>, MasterProgress> when(DeferredRunnable<P1> runnableP1, DeferredRunnable<P2> runnableP2) Submits 2DeferredRunnables returns a combinedPromise. The combined promise signalsfailas soon as any of the runnables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
P1- the progress type of the first runnableP2- the progress type of the second runnable- Parameters:
runnableP1- the first runnable to be resolvedrunnableP2- the second runnable to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<P1,P2, Promise<MultipleResults3<Void,P3> Void, whenVoid>, OneReject<Throwable>, MasterProgress> (DeferredRunnable<P1> runnableP1, DeferredRunnable<P2> runnableP2, DeferredRunnable<P3> runnableP3) Submits 3DeferredRunnables returns a combinedPromise. The combined promise signalsfailas soon as any of the runnables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
P1- the progress type of the first runnableP2- the progress type of the second runnableP3- the progress type of the third runnable- Parameters:
runnableP1- the first runnable to be resolvedrunnableP2- the second runnable to be resolvedrunnableP3- the third runnable to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<P1,P2, Promise<MultipleResults4<Void,P3, P4> Void, whenVoid, Void>, OneReject<Throwable>, MasterProgress> (DeferredRunnable<P1> runnableP1, DeferredRunnable<P2> runnableP2, DeferredRunnable<P3> runnableP3, DeferredRunnable<P4> runnableP4) Submits 4DeferredRunnables returns a combinedPromise. The combined promise signalsfailas soon as any of the runnables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
P1- the progress type of the first runnableP2- the progress type of the second runnableP3- the progress type of the third runnableP4- the progress type of the fourth runnable- Parameters:
runnableP1- the first runnable to be resolvedrunnableP2- the second runnable to be resolvedrunnableP3- the third runnable to be resolvedrunnableP4- the fourth runnable to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<P1,P2, Promise<MultipleResults5<Void,P3, P4, P5> Void, whenVoid, Void, Void>, OneReject<Throwable>, MasterProgress> (DeferredRunnable<P1> runnableP1, DeferredRunnable<P2> runnableP2, DeferredRunnable<P3> runnableP3, DeferredRunnable<P4> runnableP4, DeferredRunnable<P5> runnableP5) Submits 5DeferredRunnables returns a combinedPromise. The combined promise signalsfailas soon as any of the runnables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
P1- the progress type of the first runnableP2- the progress type of the second runnableP3- the progress type of the third runnableP4- the progress type of the fourth runnableP5- the progress type of the fifth runnable- Parameters:
runnableP1- the first runnable to be resolvedrunnableP2- the second runnable to be resolvedrunnableP3- the third runnable to be resolvedrunnableP4- the fourth runnable to be resolvedrunnableP5- the fifth runnable to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<P1,P2, Promise<MultipleResultsN<Void,P3, P4, P5> Void, whenVoid, Void, Void>, OneReject<Throwable>, MasterProgress> (DeferredRunnable<P1> runnableP1, DeferredRunnable<P2> runnableP2, DeferredRunnable<P3> runnableP3, DeferredRunnable<P4> runnableP4, DeferredRunnable<P5> runnableP5, DeferredRunnable<?> runnable6, DeferredRunnable<?>... runnables) SubmitsNDeferredRunnables returns a combinedPromise. The combined promise signalsfailas soon as any of the runnables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
P1- the progress type of the first runnableP2- the progress type of the second runnableP3- the progress type of the third runnableP4- the progress type of the fourth runnableP5- the progress type of the fifth runnable- Parameters:
runnableP1- the first runnable to be resolvedrunnableP2- the second runnable to be resolvedrunnableP3- the third runnable to be resolvedrunnableP4- the fourth runnable to be resolvedrunnableP5- the fifth runnable to be resolvedrunnables- additional runnables to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2> Promise<MultipleResults2<V1,V2>, OneReject<Throwable>, MasterProgress> when(DeferredCallable<V1, ?> callableV1, DeferredCallable<V2, ?> callableV2) Submits 2DeferredCallables returns a combinedPromise. The combined promise signalsfailas soon as any of the callables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first callableV2- the resolve type of the second callable- Parameters:
callableV1- the first callable to be resolvedcallableV2- the second callable to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResults3<V1,V3> V2, whenV3>, OneReject<Throwable>, MasterProgress> (DeferredCallable<V1, ?> callableV1, DeferredCallable<V2, ?> callableV2, DeferredCallable<V3, ?> callableV3) Submits 3DeferredCallables returns a combinedPromise. The combined promise signalsfailas soon as any of the callables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first callableV2- the resolve type of the second callableV3- the resolve type of the third callable- Parameters:
callableV1- the first callable to be resolvedcallableV2- the second callable to be resolvedcallableV3- the third callable to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResults4<V1,V3, V4> V2, whenV3, V4>, OneReject<Throwable>, MasterProgress> (DeferredCallable<V1, ?> callableV1, DeferredCallable<V2, ?> callableV2, DeferredCallable<V3, ?> callableV3, DeferredCallable<V4, ?> callableV4) Submits 4DeferredCallables returns a combinedPromise. The combined promise signalsfailas soon as any of the callables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first callableV2- the resolve type of the second callableV3- the resolve type of the third callableV4- the resolve type of the fourth callable- Parameters:
callableV1- the first callable to be resolvedcallableV2- the second callable to be resolvedcallableV3- the third callable to be resolvedcallableV4- the fourth callable to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResults5<V1,V3, V4, V5> V2, whenV3, V4, V5>, OneReject<Throwable>, MasterProgress> (DeferredCallable<V1, ?> callableV1, DeferredCallable<V2, ?> callableV2, DeferredCallable<V3, ?> callableV3, DeferredCallable<V4, ?> callableV4, DeferredCallable<V5, ?> callableV5) Submits 5DeferredCallables returns a combinedPromise. The combined promise signalsfailas soon as any of the callables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first callableV2- the resolve type of the second callableV3- the resolve type of the third callableV4- the resolve type of the fourth callableV5- the resolve type of the fifth callable- Parameters:
callableV1- the first callable to be resolvedcallableV2- the second callable to be resolvedcallableV3- the third callable to be resolvedcallableV4- the fourth callable to be resolvedcallableV5- the fifth callable to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResultsN<V1,V3, V4, V5> V2, whenV3, V4, V5>, OneReject<Throwable>, MasterProgress> (DeferredCallable<V1, ?> callableV1, DeferredCallable<V2, ?> callableV2, DeferredCallable<V3, ?> callableV3, DeferredCallable<V4, ?> callableV4, DeferredCallable<V5, ?> callableV5, DeferredCallable<?, ?> callable6, DeferredCallable<?, ?>... callables) SubmitsNDeferredCallables returns a combinedPromise. The combined promise signalsfailas soon as any of the callables rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first callableV2- the resolve type of the second callableV3- the resolve type of the third callableV4- the resolve type of the fourth callableV5- the resolve type of the fifth callable- Parameters:
callableV1- the first callable to be resolvedcallableV2- the second callable to be resolvedcallableV3- the third callable to be resolvedcallableV4- the fourth callable to be resolvedcallableV5- the fifth callable to be resolvedcallables- additional callables to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2> Promise<MultipleResults2<V1,V2>, OneReject<Throwable>, MasterProgress> when(DeferredFutureTask<V1, ?> taskV1, DeferredFutureTask<V2, ?> taskV2) Submits 2DeferredFutureTasks returns a combinedPromise. The combined promise signalsfailas soon as any of the tasks rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first taskV2- the resolve type of the second task- Parameters:
taskV1- the first task to be resolvedtaskV2- the second task to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResults3<V1,V3> V2, whenV3>, OneReject<Throwable>, MasterProgress> (DeferredFutureTask<V1, ?> taskV1, DeferredFutureTask<V2, ?> taskV2, DeferredFutureTask<V3, ?> taskV3) Submits 3DeferredFutureTasks returns a combinedPromise. The combined promise signalsfailas soon as any of the tasks rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first taskV2- the resolve type of the second taskV3- the resolve type of the third task- Parameters:
taskV1- the first task to be resolvedtaskV2- the second task to be resolvedtaskV3- the third task to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResults4<V1,V3, V4> V2, whenV3, V4>, OneReject<Throwable>, MasterProgress> (DeferredFutureTask<V1, ?> taskV1, DeferredFutureTask<V2, ?> taskV2, DeferredFutureTask<V3, ?> taskV3, DeferredFutureTask<V4, ?> taskV4) Submits 4DeferredFutureTasks returns a combinedPromise. The combined promise signalsfailas soon as any of the tasks rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first taskV2- the resolve type of the second taskV3- the resolve type of the third taskV4- the resolve type of the fourth task- Parameters:
taskV1- the first task to be resolvedtaskV2- the second task to be resolvedtaskV3- the third task to be resolvedtaskV4- the fourth task to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResults5<V1,V3, V4, V5> V2, whenV3, V4, V5>, OneReject<Throwable>, MasterProgress> (DeferredFutureTask<V1, ?> taskV1, DeferredFutureTask<V2, ?> taskV2, DeferredFutureTask<V3, ?> taskV3, DeferredFutureTask<V4, ?> taskV4, DeferredFutureTask<V5, ?> taskV5) Submits 5DeferredFutureTasks returns a combinedPromise. The combined promise signalsfailas soon as any of the tasks rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first taskV2- the resolve type of the second taskV3- the resolve type of the third taskV4- the resolve type of the fourth taskV5- the resolve type of the fifth task- Parameters:
taskV1- the first task to be resolvedtaskV2- the second task to be resolvedtaskV3- the third task to be resolvedtaskV4- the fourth task to be resolvedtaskV5- the fifth task to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResultsN<V1,V3, V4, V5> V2, whenV3, V4, V5>, OneReject<Throwable>, MasterProgress> (DeferredFutureTask<V1, ?> taskV1, DeferredFutureTask<V2, ?> taskV2, DeferredFutureTask<V3, ?> taskV3, DeferredFutureTask<V4, ?> taskV4, DeferredFutureTask<V5, ?> taskV5, DeferredFutureTask<?, ?> task6, DeferredFutureTask<?, ?>... tasks) SubmitsNDeferredFutureTasks returns a combinedPromise. The combined promise signalsfailas soon as any of the tasks rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first taskV2- the resolve type of the second taskV3- the resolve type of the third taskV4- the resolve type of the fourth taskV5- the resolve type of the fifth task- Parameters:
taskV1- the first task to be resolvedtaskV2- the second task to be resolvedtaskV3- the third task to be resolvedtaskV4- the fourth task to be resolvedtaskV5- the fifth task to be resolvedtasks- additional tasks to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2> Promise<MultipleResults2<V1,V2>, OneReject<Throwable>, MasterProgress> when(Future<V1> futureV1, Future<V2> futureV2) Submits 2Futures returns a combinedPromise. The combined promise signalsfailas soon as any of the futures rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first futureV2- the resolve type of the second future- Parameters:
futureV1- the first future to be resolvedfutureV2- the second future to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResults3<V1,V3> V2, whenV3>, OneReject<Throwable>, MasterProgress> (Future<V1> futureV1, Future<V2> futureV2, Future<V3> futureV3) Submits 3Futures returns a combinedPromise. The combined promise signalsfailas soon as any of the futures rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first futureV2- the resolve type of the second futureV3- the resolve type of the third future- Parameters:
futureV1- the first future to be resolvedfutureV2- the second future to be resolvedfutureV3- the third future to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResults4<V1,V3, V4> V2, whenV3, V4>, OneReject<Throwable>, MasterProgress> (Future<V1> futureV1, Future<V2> futureV2, Future<V3> futureV3, Future<V4> futureV4) Submits 4Futures returns a combinedPromise. The combined promise signalsfailas soon as any of the futures rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first futureV2- the resolve type of the second futureV3- the resolve type of the third futureV4- the resolve type of the fourth future- Parameters:
futureV1- the first future to be resolvedfutureV2- the second future to be resolvedfutureV3- the third future to be resolvedfutureV4- the fourth future to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResults5<V1,V3, V4, V5> V2, whenV3, V4, V5>, OneReject<Throwable>, MasterProgress> (Future<V1> futureV1, Future<V2> futureV2, Future<V3> futureV3, Future<V4> futureV4, Future<V5> futureV5) Submits 5Futures returns a combinedPromise. The combined promise signalsfailas soon as any of the futures rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first futureV2- the resolve type of the second futureV3- the resolve type of the third futureV4- the resolve type of the fourth futureV5- the resolve type of the fifth future- Parameters:
futureV1- the first future to be resolvedfutureV2- the second future to be resolvedfutureV3- the third future to be resolvedfutureV4- the fourth future to be resolvedfutureV5- the fifth future to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
when
<V1,V2, Promise<MultipleResultsN<V1,V3, V4, V5> V2, whenV3, V4, V5>, OneReject<Throwable>, MasterProgress> (Future<V1> futureV1, Future<V2> futureV2, Future<V3> futureV3, Future<V4> futureV4, Future<V5> futureV5, Future<?> future6, Future<?>... futures) SubmitsNFutures returns a combinedPromise. The combined promise signalsfailas soon as any of the futures rejects its value. The return type of the combinedPromisecontains all resolved values.- Type Parameters:
V1- the resolve type of the first futureV2- the resolve type of the second futureV3- the resolve type of the third futureV4- the resolve type of the fourth futureV5- the resolve type of the fifth future- Parameters:
futureV1- the first future to be resolvedfutureV2- the second future to be resolvedfutureV3- the third future to be resolvedfutureV4- the fourth future to be resolvedfutureV5- the fifth future to be resolvedfutures- additional futures to be resolved- Returns:
- a combined
Promise - Since:
- 2.0
-
race
Promise<OneResult<?>, OneReject<Throwable>, Void> race(Runnable runnableV1, Runnable runnableV2, Runnable... runnables) Creates aPromisethat signalsdoneorrejectwhen the first runnable does so. Wraps eachrunnablewithDeferredFutureTask.- Parameters:
runnableV1- a task to be executed. Must not be nullrunnableV2- a task to be executed. Must not be nullrunnables- additional tasks to be executed. May be null- Returns:
- a composite
Promisethat resolves/rejects as soon as the first of the submitted tasks is resolved/rejected. - Since:
- 2.0
-
race
Promise<OneResult<?>, OneReject<Throwable>, Void> race(Callable<?> callableV1, Callable<?> callableV2, Callable<?>... callables) Creates aPromisethat signalsdoneorrejectwhen the first callable does so. Wraps eachcallablewithDeferredFutureTask.- Parameters:
callableV1- a task to be executed. Must not be nullcallableV2- a task to be executed. Must not be nullcallables- additional tasks to be executed. May be null- Returns:
- a composite
Promisethat resolves/rejects as soon as the first of the submitted tasks is resolved/rejected. - Since:
- 2.0
-
race
Promise<OneResult<?>, OneReject<Throwable>, Void> race(DeferredRunnable<?> runnableV1, DeferredRunnable<?> runnableV2, DeferredRunnable<?>... runnables) Creates aPromisethat signalsdoneorrejectwhen the first runnable does so. Wraps eachrunnablewithDeferredFutureTask.- Parameters:
runnableV1- a task to be executed. Must not be nullrunnableV2- a task to be executed. Must not be nullrunnables- additional tasks to be executed. May be null- Returns:
- a composite
Promisethat resolves/rejects as soon as the first of the submitted tasks is resolved/rejected. - Since:
- 2.0
-
race
Promise<OneResult<?>, OneReject<Throwable>, Void> race(DeferredCallable<?, ?> callableV1, DeferredCallable<?, ?> callableV2, DeferredCallable<?, ?>... callables) Creates aPromisethat signalsdoneorrejectwhen the first callable does so. Wraps eachcallablewithDeferredFutureTask.- Parameters:
callableV1- a task to be executed. Must not be nullcallableV2- a task to be executed. Must not be nullcallables- additional tasks to be executed. May be null- Returns:
- a composite
Promisethat resolves/rejects as soon as the first of the submitted tasks is resolved/rejected. - Since:
- 2.0
-
race
Promise<OneResult<?>, OneReject<Throwable>, Void> race(Future<?> futureV1, Future<?> futureV2, Future<?>... futures) Creates aPromisethat signalsdoneorrejectwhen the first future does so. Wraps eachfuturewithDeferredFutureTask.- Parameters:
futureV1- a task to be executed. Must not be nullfutureV2- a task to be executed. Must not be nullfutures- additional tasks to be executed. May be null- Returns:
- a composite
Promisethat resolves/rejects as soon as the first of the submitted tasks is resolved/rejected. - Since:
- 2.0
-
race
Promise<OneResult<?>, OneReject<Throwable>, Void> race(DeferredFutureTask<?, ?> taskV1, DeferredFutureTask<?, ?> taskV2, DeferredFutureTask<?, ?>... tasks) - Parameters:
taskV1- a task to be executed. Must not be nulltaskV2- a task to be executed. Must not be nulltasks- additional tasks to be executed. May be null- Returns:
- a composite
Promisethat resolves/rejects as soon as the first of the submitted tasks is resolved/rejected. - Since:
- 2.0
-
settle
Promise<AllValues, Throwable, MasterProgress> settle(Runnable runnableV1, Runnable runnableV2, Runnable... runnables) Creates aPromisethat signalsdoneorrejectwhen each runnable does so. Wraps eachrunnablewithDeferredFutureTask.- Parameters:
runnableV1- a task to be executed. Must not be nullrunnableV2- a task to be executed. Must not be nullrunnables- additional tasks to be executed. May be null- Returns:
- a composite
Promisethat collects resolve/reject values from all tasks. - Since:
- 2.0
-
settle
Promise<AllValues, Throwable, MasterProgress> settle(Callable<?> callableV1, Callable<?> callableV2, Callable<?>... callables) Creates aPromisethat signalsdoneorrejectwhen each callable does so. Wraps eachcallablewithDeferredFutureTask.- Parameters:
callableV1- a task to be executed. Must not be nullcallableV2- a task to be executed. Must not be nullcallables- additional tasks to be executed. May be null- Returns:
- a composite
Promisethat collects resolve/reject values from all tasks. - Since:
- 2.0
-
settle
Promise<AllValues, Throwable, MasterProgress> settle(DeferredRunnable<?> runnableV1, DeferredRunnable<?> runnableV2, DeferredRunnable<?>... runnables) Creates aPromisethat signalsdoneorrejectwhen each runnable does so. Wraps eachrunnablewithDeferredFutureTask.- Parameters:
runnableV1- a task to be executed. Must not be nullrunnableV2- a task to be executed. Must not be nullrunnables- additional tasks to be executed. May be null- Returns:
- a composite
Promisethat collects resolve/reject values from all tasks. - Since:
- 2.0
-
settle
Promise<AllValues, Throwable, MasterProgress> settle(DeferredCallable<?, ?> callableV1, DeferredCallable<?, ?> callableV2, DeferredCallable<?, ?>... callables) Creates aPromisethat signalsdoneorrejectwhen each callable does so. Wraps eachcallablewithDeferredFutureTask.- Parameters:
callableV1- a task to be executed. Must not be nullcallableV2- a task to be executed. Must not be nullcallables- additional tasks to be executed. May be null- Returns:
- a composite
Promisethat collects resolve/reject values from all tasks. - Since:
- 2.0
-
settle
Promise<AllValues, Throwable, MasterProgress> settle(Future<?> futureV1, Future<?> futureV2, Future<?>... futures) Creates aPromisethat signalsdoneorrejectwhen each future does so. Wraps eachfuturewithDeferredFutureTask.- Parameters:
futureV1- a task to be executed. Must not be nullfutureV2- a task to be executed. Must not be nullfutures- additional tasks to be executed. May be null- Returns:
- a composite
Promisethat collects resolve/reject values from all tasks. - Since:
- 2.0
-
settle
Promise<AllValues, Throwable, MasterProgress> settle(DeferredFutureTask<?, ?> taskV1, DeferredFutureTask<?, ?> taskV2, DeferredFutureTask<?, ?>... tasks) - Parameters:
taskV1- a task to be executed. Must not be nulltaskV2- a task to be executed. Must not be nulltasks- additional tasks to be executed. May be null- Returns:
- a composite
Promisethat collects resolve/reject values from all tasks. - Since:
- 2.0
-
settle
Promise<AllValues, Throwable, MasterProgress> settle(Promise<?, ?, ?> promiseV1, Promise<?, ?, ?> promiseV2, Promise<?, ?, ?>... promises) - Parameters:
promiseV1- a promise. Must not be nullpromiseV2- a promise. Must not be nullpromises- additional promises. May be null- Returns:
- a composite
Promisethat collects resolve/reject values from all promises. - Since:
- 2.0
-
when
Accept an iterable of a variety of different object types, and convert it into corresponding Promise. E.g., if an item is aCallable, it'll callwhen(Callable)to convert that into a Promise.If the item is of an unknown type, it'll throw an
IllegalArgumentException.- Parameters:
iterable- the source of tasks. Must be non-null and not empty. Every item must be convertible toPromise- Returns:
- a composite
Promisethat rejects as soon as the first of the submitted tasks is rejected or contains the resolution of all given tasks. - Throws:
IllegalArgumentException- if any item in iterable cannot be converted to aPromise- Since:
- 2.0
-
race
Creates aPromisethat signalsdoneorrejectwhen the first task does so. If an item is aCallable, it'll callwhen(Callable)to convert that into a Promise.If the item is of an unknown type, it'll throw an
IllegalArgumentException. WARNING: does not accept items of typePromise.- Parameters:
iterable- the source of tasks. Must be non-null and not empty. Every item must be convertible toPromise- Returns:
- a composite
Promisethat resolves/rejects as soon as the first of the submitted tasks is resolved/rejected. - Throws:
IllegalArgumentException- if any item in iterable cannot be converted to aPromise- Since:
- 2.0
-
settle
Creates aPromisethat signalsdoneorrejectwhen each task does so. If an item is aCallable, it'll callwhen(Callable)to convert that into a Promise.If the item is of an unknown type, it'll throw an
IllegalArgumentException.- Parameters:
iterable- the source of tasks. Must be non-null and not empty. Every item must be convertible toPromise- Returns:
- a composite
Promisethat collects resolve/reject values from all promises. - Throws:
IllegalArgumentException- if any item in iterable cannot be converted to aPromise- Since:
- 2.0
-
resolve
-
reject
-