Class PromiseNotifier<V,​F extends Future<V>>

    • Constructor Detail

      • PromiseNotifier

        @SafeVarargs
        public PromiseNotifier​(Promise<? super V>... promises)
        Create a new instance.
        Parameters:
        promises - the Promises to notify once this GenericFutureListener is notified.
      • PromiseNotifier

        @SafeVarargs
        public PromiseNotifier​(boolean logNotifyFailure,
                               Promise<? super V>... promises)
        Create a new instance.
        Parameters:
        logNotifyFailure - true if logging should be done in case notification fails.
        promises - the Promises to notify once this GenericFutureListener is notified.
    • Method Detail

      • cascade

        public static <V,​F extends Future<V>> F cascade​(F future,
                                                              Promise<? super V> promise)
        Link the Future and Promise such that if the Future completes the Promise will be notified. Cancellation is propagated both ways such that if the Future is cancelled the Promise is cancelled and vise-versa.
        Type Parameters:
        V - the type of the value.
        F - the type of the Future
        Parameters:
        future - the Future which will be used to listen to for notifying the Promise.
        promise - the Promise which will be notified
        Returns:
        the passed in Future
      • cascade

        public static <V,​F extends Future<V>> F cascade​(boolean logNotifyFailure,
                                                              F future,
                                                              Promise<? super V> promise)
        Link the Future and Promise such that if the Future completes the Promise will be notified. Cancellation is propagated both ways such that if the Future is cancelled the Promise is cancelled and vise-versa.
        Type Parameters:
        V - the type of the value.
        F - the type of the Future
        Parameters:
        logNotifyFailure - true if logging should be done in case notification fails.
        future - the Future which will be used to listen to for notifying the Promise.
        promise - the Promise which will be notified
        Returns:
        the passed in Future
      • operationComplete

        public void operationComplete​(F future)
                               throws java.lang.Exception
        Description copied from interface: GenericFutureListener
        Invoked when the operation associated with the Future has been completed.
        Specified by:
        operationComplete in interface GenericFutureListener<V>
        Parameters:
        future - the source Future which called this callback
        Throws:
        java.lang.Exception