Interface CompletablePromise<V>

All Superinterfaces:
Promise<V>

public interface CompletablePromise<V> extends Promise<V>
Promise that exposes completion methods.
  • Method Details

    • complete

      boolean complete(V value)
      Completes this Promise with a value if not yet done.
      Returns:
      true if wasn't already completed.
    • completeExceptionally

      boolean completeExceptionally(RuntimeException value)
      Completes this Promise with a an exception if not yet done.
      Returns:
      true if wasn't already completed.
    • completeFrom

      boolean completeFrom(Promise<V> source)
      Completes or completes exceptionally this promise from the source promise when it becomes completed.
      
       destination.completeFrom(source);
       
      Is shortcut to:
      
       source.handle((value, failure) -> {
          if (failure != null) {
             destination.completeExceptionally(failure);
          } else {
             destination.complete(value);
          }
          return null;
       }
       
      Parameters:
      source - promise that is being watched.
      Returns:
      false if source already completed, otherwise return true or null