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

java.lang.Object
io.netty.util.concurrent.PromiseNotifier<V,F>
Type Parameters:
V - the type of value returned by the future
F - the type of future
All Implemented Interfaces:
GenericFutureListener<F>, EventListener
Direct Known Subclasses:
ChannelPromiseNotifier

public class PromiseNotifier<V,F extends Future<V>> extends Object implements GenericFutureListener<F>
GenericFutureListener implementation which takes other Promises and notifies them on completion.
  • Field Details

    • logger

      private static final InternalLogger logger
    • promises

      private final Promise<? super V>[] promises
    • logNotifyFailure

      private final boolean logNotifyFailure
  • Constructor Details

    • 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 Details

    • 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 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:
      Exception