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:
    DefaultDeferredManager
    • Method Detail

      • when

        <D,​F,​P> Promise<D,​F,​P> when​(Promise<D,​F,​P> promise)
        Simply returns the promise.
        Parameters:
        promise -
        Returns:
        promise
      • when

        <D> Promise<D,​java.lang.Throwable,​java.lang.Void> when​(java.util.concurrent.Future<D> future)
        Wraps Future and waits for Future.get() to return a result in the background.
        Parameters:
        future -
        Returns:
        when(Callable)
      • when

        <F,​V1,​V2> Promise<MultipleResults2<V1,​V2>,​OneReject<F>,​MasterProgress> when​(Promise<V1,​?,​?> promiseV1,
                                                                                                                  Promise<V2,​?,​?> promiseV2)
        Submits 2 Promises returns a combined Promise. The combined promise signals fail as soon as any of the promises rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        F - the common type the promises may reject
        V1 - the resolve type of the first promise
        V2 - the resolve type of the second promise
        Parameters:
        promiseV1 - the first promise to be resolved
        promiseV2 - the second promise to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <F,​V1,​V2,​V3> Promise<MultipleResults3<V1,​V2,​V3>,​OneReject<F>,​MasterProgress> when​(Promise<V1,​?,​?> promiseV1,
                                                                                                                                    Promise<V2,​?,​?> promiseV2,
                                                                                                                                    Promise<V3,​?,​?> promiseV3)
        Submits 3 Promises returns a combined Promise. The combined promise signals fail as soon as any of the promises rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        F - the common type the promises may reject
        V1 - the resolve type of the first promise
        V2 - the resolve type of the second promise
        V3 - the resolve type of the third promise
        Parameters:
        promiseV1 - the first promise to be resolved
        promiseV2 - the second promise to be resolved
        promiseV3 - the third promise to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <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 4 Promises returns a combined Promise. The combined promise signals fail as soon as any of the promises rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        F - the common type the promises may reject
        V1 - the resolve type of the first promise
        V2 - the resolve type of the second promise
        V3 - the resolve type of the third promise
        V4 - the resolve type of the fourth promise
        Parameters:
        promiseV1 - the first promise to be resolved
        promiseV2 - the second promise to be resolved
        promiseV3 - the third promise to be resolved
        promiseV4 - the fourth promise to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <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 5 Promises returns a combined Promise. The combined promise signals fail as soon as any of the promises rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        F - the common type the promises may reject
        V1 - the resolve type of the first promise
        V2 - the resolve type of the second promise
        V3 - the resolve type of the third promise
        V4 - the resolve type of the fourth promise
        V5 - the resolve type of the fifth promise
        Parameters:
        promiseV1 - the first promise to be resolved
        promiseV2 - the second promise to be resolved
        promiseV3 - the third promise to be resolved
        promiseV4 - the fourth promise to be resolved
        promiseV5 - the fifth promise to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <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)
        Submits N Promises returns a combined Promise. The combined promise signals fail as soon as any of the promises rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        F - the common type the promises may reject
        V1 - the resolve type of the first promise
        V2 - the resolve type of the second promise
        V3 - the resolve type of the third promise
        V4 - the resolve type of the fourth promise
        V5 - the resolve type of the fifth promise
        Parameters:
        promiseV1 - the first promise to be resolved
        promiseV2 - the second promise to be resolved
        promiseV3 - the third promise to be resolved
        promiseV4 - the fourth promise to be resolved
        promiseV5 - the fifth promise to be resolved
        promises - additional promises to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2> Promise<MultipleResults2<V1,​V2>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(java.util.concurrent.Callable<V1> callableV1,
                                                                                                                            java.util.concurrent.Callable<V2> callableV2)
        Submits 2 Callables returns a combined Promise. The combined promise signals fail as soon as any of the callables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first callable
        V2 - the resolve type of the second callable
        Parameters:
        callableV1 - the first callable to be resolved
        callableV2 - the second callable to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3> Promise<MultipleResults3<V1,​V2,​V3>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(java.util.concurrent.Callable<V1> callableV1,
                                                                                                                                              java.util.concurrent.Callable<V2> callableV2,
                                                                                                                                              java.util.concurrent.Callable<V3> callableV3)
        Submits 3 Callables returns a combined Promise. The combined promise signals fail as soon as any of the callables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first callable
        V2 - the resolve type of the second callable
        V3 - the resolve type of the third callable
        Parameters:
        callableV1 - the first callable to be resolved
        callableV2 - the second callable to be resolved
        callableV3 - the third callable to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3,​V4> Promise<MultipleResults4<V1,​V2,​V3,​V4>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(java.util.concurrent.Callable<V1> callableV1,
                                                                                                                                                                java.util.concurrent.Callable<V2> callableV2,
                                                                                                                                                                java.util.concurrent.Callable<V3> callableV3,
                                                                                                                                                                java.util.concurrent.Callable<V4> callableV4)
        Submits 4 Callables returns a combined Promise. The combined promise signals fail as soon as any of the callables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first callable
        V2 - the resolve type of the second callable
        V3 - the resolve type of the third callable
        V4 - the resolve type of the fourth callable
        Parameters:
        callableV1 - the first callable to be resolved
        callableV2 - the second callable to be resolved
        callableV3 - the third callable to be resolved
        callableV4 - the fourth callable to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3,​V4,​V5> Promise<MultipleResults5<V1,​V2,​V3,​V4,​V5>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(java.util.concurrent.Callable<V1> callableV1,
                                                                                                                                                                                  java.util.concurrent.Callable<V2> callableV2,
                                                                                                                                                                                  java.util.concurrent.Callable<V3> callableV3,
                                                                                                                                                                                  java.util.concurrent.Callable<V4> callableV4,
                                                                                                                                                                                  java.util.concurrent.Callable<V5> callableV5)
        Submits 5 Callables returns a combined Promise. The combined promise signals fail as soon as any of the callables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first callable
        V2 - the resolve type of the second callable
        V3 - the resolve type of the third callable
        V4 - the resolve type of the fourth callable
        V5 - the resolve type of the fifth callable
        Parameters:
        callableV1 - the first callable to be resolved
        callableV2 - the second callable to be resolved
        callableV3 - the third callable to be resolved
        callableV4 - the fourth callable to be resolved
        callableV5 - the fifth callable to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3,​V4,​V5> Promise<MultipleResultsN<V1,​V2,​V3,​V4,​V5>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(java.util.concurrent.Callable<V1> callableV1,
                                                                                                                                                                                  java.util.concurrent.Callable<V2> callableV2,
                                                                                                                                                                                  java.util.concurrent.Callable<V3> callableV3,
                                                                                                                                                                                  java.util.concurrent.Callable<V4> callableV4,
                                                                                                                                                                                  java.util.concurrent.Callable<V5> callableV5,
                                                                                                                                                                                  java.util.concurrent.Callable<?> callable6,
                                                                                                                                                                                  java.util.concurrent.Callable<?>... callables)
        Submits N Callables returns a combined Promise. The combined promise signals fail as soon as any of the callables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first callable
        V2 - the resolve type of the second callable
        V3 - the resolve type of the third callable
        V4 - the resolve type of the fourth callable
        V5 - the resolve type of the fifth callable
        Parameters:
        callableV1 - the first callable to be resolved
        callableV2 - the second callable to be resolved
        callableV3 - the third callable to be resolved
        callableV4 - the fourth callable to be resolved
        callableV5 - the fifth callable to be resolved
        callables - additional callables to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <P1,​P2> Promise<MultipleResults2<java.lang.Void,​java.lang.Void>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredRunnable<P1> runnableP1,
                                                                                                                                                    DeferredRunnable<P2> runnableP2)
        Submits 2 DeferredRunnables returns a combined Promise. The combined promise signals fail as soon as any of the runnables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        P1 - the progress type of the first runnable
        P2 - the progress type of the second runnable
        Parameters:
        runnableP1 - the first runnable to be resolved
        runnableP2 - the second runnable to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <P1,​P2,​P3> Promise<MultipleResults3<java.lang.Void,​java.lang.Void,​java.lang.Void>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredRunnable<P1> runnableP1,
                                                                                                                                                                                  DeferredRunnable<P2> runnableP2,
                                                                                                                                                                                  DeferredRunnable<P3> runnableP3)
        Submits 3 DeferredRunnables returns a combined Promise. The combined promise signals fail as soon as any of the runnables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        P1 - the progress type of the first runnable
        P2 - the progress type of the second runnable
        P3 - the progress type of the third runnable
        Parameters:
        runnableP1 - the first runnable to be resolved
        runnableP2 - the second runnable to be resolved
        runnableP3 - the third runnable to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <P1,​P2,​P3,​P4> Promise<MultipleResults4<java.lang.Void,​java.lang.Void,​java.lang.Void,​java.lang.Void>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredRunnable<P1> runnableP1,
                                                                                                                                                                                                                DeferredRunnable<P2> runnableP2,
                                                                                                                                                                                                                DeferredRunnable<P3> runnableP3,
                                                                                                                                                                                                                DeferredRunnable<P4> runnableP4)
        Submits 4 DeferredRunnables returns a combined Promise. The combined promise signals fail as soon as any of the runnables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        P1 - the progress type of the first runnable
        P2 - the progress type of the second runnable
        P3 - the progress type of the third runnable
        P4 - the progress type of the fourth runnable
        Parameters:
        runnableP1 - the first runnable to be resolved
        runnableP2 - the second runnable to be resolved
        runnableP3 - the third runnable to be resolved
        runnableP4 - the fourth runnable to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <P1,​P2,​P3,​P4,​P5> Promise<MultipleResults5<java.lang.Void,​java.lang.Void,​java.lang.Void,​java.lang.Void,​java.lang.Void>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredRunnable<P1> runnableP1,
                                                                                                                                                                                                                                              DeferredRunnable<P2> runnableP2,
                                                                                                                                                                                                                                              DeferredRunnable<P3> runnableP3,
                                                                                                                                                                                                                                              DeferredRunnable<P4> runnableP4,
                                                                                                                                                                                                                                              DeferredRunnable<P5> runnableP5)
        Submits 5 DeferredRunnables returns a combined Promise. The combined promise signals fail as soon as any of the runnables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        P1 - the progress type of the first runnable
        P2 - the progress type of the second runnable
        P3 - the progress type of the third runnable
        P4 - the progress type of the fourth runnable
        P5 - the progress type of the fifth runnable
        Parameters:
        runnableP1 - the first runnable to be resolved
        runnableP2 - the second runnable to be resolved
        runnableP3 - the third runnable to be resolved
        runnableP4 - the fourth runnable to be resolved
        runnableP5 - the fifth runnable to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <P1,​P2,​P3,​P4,​P5> Promise<MultipleResultsN<java.lang.Void,​java.lang.Void,​java.lang.Void,​java.lang.Void,​java.lang.Void>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredRunnable<P1> runnableP1,
                                                                                                                                                                                                                                              DeferredRunnable<P2> runnableP2,
                                                                                                                                                                                                                                              DeferredRunnable<P3> runnableP3,
                                                                                                                                                                                                                                              DeferredRunnable<P4> runnableP4,
                                                                                                                                                                                                                                              DeferredRunnable<P5> runnableP5,
                                                                                                                                                                                                                                              DeferredRunnable<?> runnable6,
                                                                                                                                                                                                                                              DeferredRunnable<?>... runnables)
        Submits N DeferredRunnables returns a combined Promise. The combined promise signals fail as soon as any of the runnables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        P1 - the progress type of the first runnable
        P2 - the progress type of the second runnable
        P3 - the progress type of the third runnable
        P4 - the progress type of the fourth runnable
        P5 - the progress type of the fifth runnable
        Parameters:
        runnableP1 - the first runnable to be resolved
        runnableP2 - the second runnable to be resolved
        runnableP3 - the third runnable to be resolved
        runnableP4 - the fourth runnable to be resolved
        runnableP5 - the fifth runnable to be resolved
        runnables - additional runnables to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2> Promise<MultipleResults2<V1,​V2>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredCallable<V1,​?> callableV1,
                                                                                                                            DeferredCallable<V2,​?> callableV2)
        Submits 2 DeferredCallables returns a combined Promise. The combined promise signals fail as soon as any of the callables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first callable
        V2 - the resolve type of the second callable
        Parameters:
        callableV1 - the first callable to be resolved
        callableV2 - the second callable to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3> Promise<MultipleResults3<V1,​V2,​V3>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredCallable<V1,​?> callableV1,
                                                                                                                                              DeferredCallable<V2,​?> callableV2,
                                                                                                                                              DeferredCallable<V3,​?> callableV3)
        Submits 3 DeferredCallables returns a combined Promise. The combined promise signals fail as soon as any of the callables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first callable
        V2 - the resolve type of the second callable
        V3 - the resolve type of the third callable
        Parameters:
        callableV1 - the first callable to be resolved
        callableV2 - the second callable to be resolved
        callableV3 - the third callable to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3,​V4> Promise<MultipleResults4<V1,​V2,​V3,​V4>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredCallable<V1,​?> callableV1,
                                                                                                                                                                DeferredCallable<V2,​?> callableV2,
                                                                                                                                                                DeferredCallable<V3,​?> callableV3,
                                                                                                                                                                DeferredCallable<V4,​?> callableV4)
        Submits 4 DeferredCallables returns a combined Promise. The combined promise signals fail as soon as any of the callables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first callable
        V2 - the resolve type of the second callable
        V3 - the resolve type of the third callable
        V4 - the resolve type of the fourth callable
        Parameters:
        callableV1 - the first callable to be resolved
        callableV2 - the second callable to be resolved
        callableV3 - the third callable to be resolved
        callableV4 - the fourth callable to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3,​V4,​V5> Promise<MultipleResults5<V1,​V2,​V3,​V4,​V5>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredCallable<V1,​?> callableV1,
                                                                                                                                                                                  DeferredCallable<V2,​?> callableV2,
                                                                                                                                                                                  DeferredCallable<V3,​?> callableV3,
                                                                                                                                                                                  DeferredCallable<V4,​?> callableV4,
                                                                                                                                                                                  DeferredCallable<V5,​?> callableV5)
        Submits 5 DeferredCallables returns a combined Promise. The combined promise signals fail as soon as any of the callables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first callable
        V2 - the resolve type of the second callable
        V3 - the resolve type of the third callable
        V4 - the resolve type of the fourth callable
        V5 - the resolve type of the fifth callable
        Parameters:
        callableV1 - the first callable to be resolved
        callableV2 - the second callable to be resolved
        callableV3 - the third callable to be resolved
        callableV4 - the fourth callable to be resolved
        callableV5 - the fifth callable to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3,​V4,​V5> Promise<MultipleResultsN<V1,​V2,​V3,​V4,​V5>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredCallable<V1,​?> callableV1,
                                                                                                                                                                                  DeferredCallable<V2,​?> callableV2,
                                                                                                                                                                                  DeferredCallable<V3,​?> callableV3,
                                                                                                                                                                                  DeferredCallable<V4,​?> callableV4,
                                                                                                                                                                                  DeferredCallable<V5,​?> callableV5,
                                                                                                                                                                                  DeferredCallable<?,​?> callable6,
                                                                                                                                                                                  DeferredCallable<?,​?>... callables)
        Submits N DeferredCallables returns a combined Promise. The combined promise signals fail as soon as any of the callables rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first callable
        V2 - the resolve type of the second callable
        V3 - the resolve type of the third callable
        V4 - the resolve type of the fourth callable
        V5 - the resolve type of the fifth callable
        Parameters:
        callableV1 - the first callable to be resolved
        callableV2 - the second callable to be resolved
        callableV3 - the third callable to be resolved
        callableV4 - the fourth callable to be resolved
        callableV5 - the fifth callable to be resolved
        callables - additional callables to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2> Promise<MultipleResults2<V1,​V2>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredFutureTask<V1,​?> taskV1,
                                                                                                                            DeferredFutureTask<V2,​?> taskV2)
        Submits 2 DeferredFutureTasks returns a combined Promise. The combined promise signals fail as soon as any of the tasks rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first task
        V2 - the resolve type of the second task
        Parameters:
        taskV1 - the first task to be resolved
        taskV2 - the second task to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3> Promise<MultipleResults3<V1,​V2,​V3>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredFutureTask<V1,​?> taskV1,
                                                                                                                                              DeferredFutureTask<V2,​?> taskV2,
                                                                                                                                              DeferredFutureTask<V3,​?> taskV3)
        Submits 3 DeferredFutureTasks returns a combined Promise. The combined promise signals fail as soon as any of the tasks rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first task
        V2 - the resolve type of the second task
        V3 - the resolve type of the third task
        Parameters:
        taskV1 - the first task to be resolved
        taskV2 - the second task to be resolved
        taskV3 - the third task to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3,​V4> Promise<MultipleResults4<V1,​V2,​V3,​V4>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredFutureTask<V1,​?> taskV1,
                                                                                                                                                                DeferredFutureTask<V2,​?> taskV2,
                                                                                                                                                                DeferredFutureTask<V3,​?> taskV3,
                                                                                                                                                                DeferredFutureTask<V4,​?> taskV4)
        Submits 4 DeferredFutureTasks returns a combined Promise. The combined promise signals fail as soon as any of the tasks rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first task
        V2 - the resolve type of the second task
        V3 - the resolve type of the third task
        V4 - the resolve type of the fourth task
        Parameters:
        taskV1 - the first task to be resolved
        taskV2 - the second task to be resolved
        taskV3 - the third task to be resolved
        taskV4 - the fourth task to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3,​V4,​V5> Promise<MultipleResults5<V1,​V2,​V3,​V4,​V5>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredFutureTask<V1,​?> taskV1,
                                                                                                                                                                                  DeferredFutureTask<V2,​?> taskV2,
                                                                                                                                                                                  DeferredFutureTask<V3,​?> taskV3,
                                                                                                                                                                                  DeferredFutureTask<V4,​?> taskV4,
                                                                                                                                                                                  DeferredFutureTask<V5,​?> taskV5)
        Submits 5 DeferredFutureTasks returns a combined Promise. The combined promise signals fail as soon as any of the tasks rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first task
        V2 - the resolve type of the second task
        V3 - the resolve type of the third task
        V4 - the resolve type of the fourth task
        V5 - the resolve type of the fifth task
        Parameters:
        taskV1 - the first task to be resolved
        taskV2 - the second task to be resolved
        taskV3 - the third task to be resolved
        taskV4 - the fourth task to be resolved
        taskV5 - the fifth task to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3,​V4,​V5> Promise<MultipleResultsN<V1,​V2,​V3,​V4,​V5>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(DeferredFutureTask<V1,​?> taskV1,
                                                                                                                                                                                  DeferredFutureTask<V2,​?> taskV2,
                                                                                                                                                                                  DeferredFutureTask<V3,​?> taskV3,
                                                                                                                                                                                  DeferredFutureTask<V4,​?> taskV4,
                                                                                                                                                                                  DeferredFutureTask<V5,​?> taskV5,
                                                                                                                                                                                  DeferredFutureTask<?,​?> task6,
                                                                                                                                                                                  DeferredFutureTask<?,​?>... tasks)
        Submits N DeferredFutureTasks returns a combined Promise. The combined promise signals fail as soon as any of the tasks rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first task
        V2 - the resolve type of the second task
        V3 - the resolve type of the third task
        V4 - the resolve type of the fourth task
        V5 - the resolve type of the fifth task
        Parameters:
        taskV1 - the first task to be resolved
        taskV2 - the second task to be resolved
        taskV3 - the third task to be resolved
        taskV4 - the fourth task to be resolved
        taskV5 - the fifth task to be resolved
        tasks - additional tasks to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2> Promise<MultipleResults2<V1,​V2>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(java.util.concurrent.Future<V1> futureV1,
                                                                                                                            java.util.concurrent.Future<V2> futureV2)
        Submits 2 Futures returns a combined Promise. The combined promise signals fail as soon as any of the futures rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first future
        V2 - the resolve type of the second future
        Parameters:
        futureV1 - the first future to be resolved
        futureV2 - the second future to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3> Promise<MultipleResults3<V1,​V2,​V3>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(java.util.concurrent.Future<V1> futureV1,
                                                                                                                                              java.util.concurrent.Future<V2> futureV2,
                                                                                                                                              java.util.concurrent.Future<V3> futureV3)
        Submits 3 Futures returns a combined Promise. The combined promise signals fail as soon as any of the futures rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first future
        V2 - the resolve type of the second future
        V3 - the resolve type of the third future
        Parameters:
        futureV1 - the first future to be resolved
        futureV2 - the second future to be resolved
        futureV3 - the third future to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3,​V4> Promise<MultipleResults4<V1,​V2,​V3,​V4>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(java.util.concurrent.Future<V1> futureV1,
                                                                                                                                                                java.util.concurrent.Future<V2> futureV2,
                                                                                                                                                                java.util.concurrent.Future<V3> futureV3,
                                                                                                                                                                java.util.concurrent.Future<V4> futureV4)
        Submits 4 Futures returns a combined Promise. The combined promise signals fail as soon as any of the futures rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first future
        V2 - the resolve type of the second future
        V3 - the resolve type of the third future
        V4 - the resolve type of the fourth future
        Parameters:
        futureV1 - the first future to be resolved
        futureV2 - the second future to be resolved
        futureV3 - the third future to be resolved
        futureV4 - the fourth future to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3,​V4,​V5> Promise<MultipleResults5<V1,​V2,​V3,​V4,​V5>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(java.util.concurrent.Future<V1> futureV1,
                                                                                                                                                                                  java.util.concurrent.Future<V2> futureV2,
                                                                                                                                                                                  java.util.concurrent.Future<V3> futureV3,
                                                                                                                                                                                  java.util.concurrent.Future<V4> futureV4,
                                                                                                                                                                                  java.util.concurrent.Future<V5> futureV5)
        Submits 5 Futures returns a combined Promise. The combined promise signals fail as soon as any of the futures rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first future
        V2 - the resolve type of the second future
        V3 - the resolve type of the third future
        V4 - the resolve type of the fourth future
        V5 - the resolve type of the fifth future
        Parameters:
        futureV1 - the first future to be resolved
        futureV2 - the second future to be resolved
        futureV3 - the third future to be resolved
        futureV4 - the fourth future to be resolved
        futureV5 - the fifth future to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • when

        <V1,​V2,​V3,​V4,​V5> Promise<MultipleResultsN<V1,​V2,​V3,​V4,​V5>,​OneReject<java.lang.Throwable>,​MasterProgress> when​(java.util.concurrent.Future<V1> futureV1,
                                                                                                                                                                                  java.util.concurrent.Future<V2> futureV2,
                                                                                                                                                                                  java.util.concurrent.Future<V3> futureV3,
                                                                                                                                                                                  java.util.concurrent.Future<V4> futureV4,
                                                                                                                                                                                  java.util.concurrent.Future<V5> futureV5,
                                                                                                                                                                                  java.util.concurrent.Future<?> future6,
                                                                                                                                                                                  java.util.concurrent.Future<?>... futures)
        Submits N Futures returns a combined Promise. The combined promise signals fail as soon as any of the futures rejects its value. The return type of the combined Promise contains all resolved values.
        Type Parameters:
        V1 - the resolve type of the first future
        V2 - the resolve type of the second future
        V3 - the resolve type of the third future
        V4 - the resolve type of the fourth future
        V5 - the resolve type of the fifth future
        Parameters:
        futureV1 - the first future to be resolved
        futureV2 - the second future to be resolved
        futureV3 - the third future to be resolved
        futureV4 - the fourth future to be resolved
        futureV5 - the fifth future to be resolved
        futures - additional futures to be resolved
        Returns:
        a combined Promise
        Since:
        2.0
      • race

        Promise<OneResult<?>,​OneReject<java.lang.Throwable>,​java.lang.Void> race​(java.lang.Runnable runnableV1,
                                                                                             java.lang.Runnable runnableV2,
                                                                                             java.lang.Runnable... runnables)
        Creates a Promise that signals done or reject when the first runnable does so. Wraps each runnable with DeferredFutureTask.
        Parameters:
        runnableV1 - a task to be executed. Must not be null
        runnableV2 - a task to be executed. Must not be null
        runnables - additional tasks to be executed. May be null
        Returns:
        a composite Promise that resolves/rejects as soon as the first of the submitted tasks is resolved/rejected.
        Since:
        2.0
      • race

        Promise<OneResult<?>,​OneReject<java.lang.Throwable>,​java.lang.Void> race​(java.util.concurrent.Callable<?> callableV1,
                                                                                             java.util.concurrent.Callable<?> callableV2,
                                                                                             java.util.concurrent.Callable<?>... callables)
        Creates a Promise that signals done or reject when the first callable does so. Wraps each callable with DeferredFutureTask.
        Parameters:
        callableV1 - a task to be executed. Must not be null
        callableV2 - a task to be executed. Must not be null
        callables - additional tasks to be executed. May be null
        Returns:
        a composite Promise that resolves/rejects as soon as the first of the submitted tasks is resolved/rejected.
        Since:
        2.0
      • race

        Promise<OneResult<?>,​OneReject<java.lang.Throwable>,​java.lang.Void> race​(DeferredRunnable<?> runnableV1,
                                                                                             DeferredRunnable<?> runnableV2,
                                                                                             DeferredRunnable<?>... runnables)
        Creates a Promise that signals done or reject when the first runnable does so. Wraps each runnable with DeferredFutureTask.
        Parameters:
        runnableV1 - a task to be executed. Must not be null
        runnableV2 - a task to be executed. Must not be null
        runnables - additional tasks to be executed. May be null
        Returns:
        a composite Promise that resolves/rejects as soon as the first of the submitted tasks is resolved/rejected.
        Since:
        2.0
      • race

        Promise<OneResult<?>,​OneReject<java.lang.Throwable>,​java.lang.Void> race​(DeferredCallable<?,​?> callableV1,
                                                                                             DeferredCallable<?,​?> callableV2,
                                                                                             DeferredCallable<?,​?>... callables)
        Creates a Promise that signals done or reject when the first callable does so. Wraps each callable with DeferredFutureTask.
        Parameters:
        callableV1 - a task to be executed. Must not be null
        callableV2 - a task to be executed. Must not be null
        callables - additional tasks to be executed. May be null
        Returns:
        a composite Promise that resolves/rejects as soon as the first of the submitted tasks is resolved/rejected.
        Since:
        2.0
      • race

        Promise<OneResult<?>,​OneReject<java.lang.Throwable>,​java.lang.Void> race​(java.util.concurrent.Future<?> futureV1,
                                                                                             java.util.concurrent.Future<?> futureV2,
                                                                                             java.util.concurrent.Future<?>... futures)
        Creates a Promise that signals done or reject when the first future does so. Wraps each future with DeferredFutureTask.
        Parameters:
        futureV1 - a task to be executed. Must not be null
        futureV2 - a task to be executed. Must not be null
        futures - additional tasks to be executed. May be null
        Returns:
        a composite Promise that resolves/rejects as soon as the first of the submitted tasks is resolved/rejected.
        Since:
        2.0
      • race

        Promise<OneResult<?>,​OneReject<java.lang.Throwable>,​java.lang.Void> race​(DeferredFutureTask<?,​?> taskV1,
                                                                                             DeferredFutureTask<?,​?> taskV2,
                                                                                             DeferredFutureTask<?,​?>... tasks)
        Creates a Promise that signals done or reject when the first task does so.
        Parameters:
        taskV1 - a task to be executed. Must not be null
        taskV2 - a task to be executed. Must not be null
        tasks - additional tasks to be executed. May be null
        Returns:
        a composite Promise that resolves/rejects as soon as the first of the submitted tasks is resolved/rejected.
        Since:
        2.0
      • settle

        Promise<AllValues,​java.lang.Throwable,​MasterProgress> settle​(java.lang.Runnable runnableV1,
                                                                                 java.lang.Runnable runnableV2,
                                                                                 java.lang.Runnable... runnables)
        Creates a Promise that signals done or reject when each runnable does so. Wraps each runnable with DeferredFutureTask.
        Parameters:
        runnableV1 - a task to be executed. Must not be null
        runnableV2 - a task to be executed. Must not be null
        runnables - additional tasks to be executed. May be null
        Returns:
        a composite Promise that collects resolve/reject values from all tasks.
        Since:
        2.0
      • settle

        Promise<AllValues,​java.lang.Throwable,​MasterProgress> settle​(java.util.concurrent.Callable<?> callableV1,
                                                                                 java.util.concurrent.Callable<?> callableV2,
                                                                                 java.util.concurrent.Callable<?>... callables)
        Creates a Promise that signals done or reject when each callable does so. Wraps each callable with DeferredFutureTask.
        Parameters:
        callableV1 - a task to be executed. Must not be null
        callableV2 - a task to be executed. Must not be null
        callables - additional tasks to be executed. May be null
        Returns:
        a composite Promise that collects resolve/reject values from all tasks.
        Since:
        2.0
      • settle

        Promise<AllValues,​java.lang.Throwable,​MasterProgress> settle​(DeferredRunnable<?> runnableV1,
                                                                                 DeferredRunnable<?> runnableV2,
                                                                                 DeferredRunnable<?>... runnables)
        Creates a Promise that signals done or reject when each runnable does so. Wraps each runnable with DeferredFutureTask.
        Parameters:
        runnableV1 - a task to be executed. Must not be null
        runnableV2 - a task to be executed. Must not be null
        runnables - additional tasks to be executed. May be null
        Returns:
        a composite Promise that collects resolve/reject values from all tasks.
        Since:
        2.0
      • settle

        Promise<AllValues,​java.lang.Throwable,​MasterProgress> settle​(DeferredCallable<?,​?> callableV1,
                                                                                 DeferredCallable<?,​?> callableV2,
                                                                                 DeferredCallable<?,​?>... callables)
        Creates a Promise that signals done or reject when each callable does so. Wraps each callable with DeferredFutureTask.
        Parameters:
        callableV1 - a task to be executed. Must not be null
        callableV2 - a task to be executed. Must not be null
        callables - additional tasks to be executed. May be null
        Returns:
        a composite Promise that collects resolve/reject values from all tasks.
        Since:
        2.0
      • settle

        Promise<AllValues,​java.lang.Throwable,​MasterProgress> settle​(java.util.concurrent.Future<?> futureV1,
                                                                                 java.util.concurrent.Future<?> futureV2,
                                                                                 java.util.concurrent.Future<?>... futures)
        Creates a Promise that signals done or reject when each future does so. Wraps each future with DeferredFutureTask.
        Parameters:
        futureV1 - a task to be executed. Must not be null
        futureV2 - a task to be executed. Must not be null
        futures - additional tasks to be executed. May be null
        Returns:
        a composite Promise that collects resolve/reject values from all tasks.
        Since:
        2.0
      • settle

        Promise<AllValues,​java.lang.Throwable,​MasterProgress> settle​(DeferredFutureTask<?,​?> taskV1,
                                                                                 DeferredFutureTask<?,​?> taskV2,
                                                                                 DeferredFutureTask<?,​?>... tasks)
        Creates a Promise that signals done or reject when each task does so.
        Parameters:
        taskV1 - a task to be executed. Must not be null
        taskV2 - a task to be executed. Must not be null
        tasks - additional tasks to be executed. May be null
        Returns:
        a composite Promise that collects resolve/reject values from all tasks.
        Since:
        2.0
      • settle

        Promise<AllValues,​java.lang.Throwable,​MasterProgress> settle​(Promise<?,​?,​?> promiseV1,
                                                                                 Promise<?,​?,​?> promiseV2,
                                                                                 Promise<?,​?,​?>... promises)
        Creates a Promise that signals done or reject when each promise does so.
        Parameters:
        promiseV1 - a promise. Must not be null
        promiseV2 - a promise. Must not be null
        promises - additional promises. May be null
        Returns:
        a composite Promise that collects resolve/reject values from all promises.
        Since:
        2.0
      • when

        Promise<MultipleResults,​OneReject<?>,​MasterProgress> when​(java.lang.Iterable<?> iterable)
        Accept an iterable of a variety of different object types, and convert it into corresponding Promise. E.g., if an item is a Callable, it'll call when(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 to Promise
        Returns:
        a composite Promise that rejects as soon as the first of the submitted tasks is rejected or contains the resolution of all given tasks.
        Throws:
        java.lang.IllegalArgumentException - if any item in iterable cannot be converted to a Promise
        Since:
        2.0
      • race

        Promise<OneResult<?>,​OneReject<java.lang.Throwable>,​java.lang.Void> race​(java.lang.Iterable<?> iterable)
        Creates a Promise that signals done or reject when the first task does so. If an item is a Callable, it'll call when(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 type Promise.

        Parameters:
        iterable - the source of tasks. Must be non-null and not empty. Every item must be convertible to Promise
        Returns:
        a composite Promise that resolves/rejects as soon as the first of the submitted tasks is resolved/rejected.
        Throws:
        java.lang.IllegalArgumentException - if any item in iterable cannot be converted to a Promise
        Since:
        2.0
      • settle

        Promise<AllValues,​java.lang.Throwable,​MasterProgress> settle​(java.lang.Iterable<?> iterable)
        Creates a Promise that signals done or reject when each task does so. If an item is a Callable, it'll call when(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 to Promise
        Returns:
        a composite Promise that collects resolve/reject values from all promises.
        Throws:
        java.lang.IllegalArgumentException - if any item in iterable cannot be converted to a Promise
        Since:
        2.0
      • resolve

        <D,​F,​P> Promise<D,​F,​P> resolve​(D resolve)
        A convenience method create a Promise that immediately resolves to a value.
        Parameters:
        resolve - value to resolve to
        Returns:
        a Promise that resolves to value
        Since:
        2.0
      • reject

        <D,​F,​P> Promise<D,​F,​P> reject​(F reject)
        A convenience method to create a Promise that immediately fails with a reason.
        Parameters:
        reject - reason to reject
        Returns:
        a Promise that rejects with reason
        Since:
        2.0