Class PromiseDelegator<T>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <> <? extends T> other, <? super T> action)  
      <> <? extends T> other, <? super T> action)  
      <> <? extends T> other, <? super T> action,  executor)  
      <U> <U> <? extends T> other, <? super T,​U> fn)  
      <U> <U> <? extends T> other, <? super T,​U> fn)  
      <U> <U> <? extends T> other, <? super T,​U> fn,  executor)  
      RPromise<T> await()
      Waits for this future to be completed.
      boolean await​(long timeoutMillis)
      Waits for this future to be completed within the specified time limit.
      boolean await​(long timeout,  unit)
      Waits for this future to be completed within the specified time limit.
      RPromise<T> awaitUninterruptibly()
      Waits for this future to be completed without interruption.
      boolean awaitUninterruptibly​(long timeoutMillis)
      Waits for this future to be completed within the specified time limit without interruption.
      boolean awaitUninterruptibly​(long timeout,  unit)
      Waits for this future to be completed within the specified time limit without interruption.
      boolean cancel​(boolean mayInterruptIfRunning)  
      cause()
      Returns the cause of the failed I/O operation if the I/O operation has failed.
      <T> <,​? extends T> fn)  
      T get()  
      T get​(long timeout,  unit)  
      RPromise<T> getInnerPromise()  
      T getNow()
      Return the result without blocking.
      <U> <U> <? super ,​? extends U> fn)  
      <U> <U> <? super ,​? extends U> fn)  
      <U> <U> <? super ,​? extends U> fn,  executor)  
      boolean hasListeners()  
      boolean isCancelled()  
      boolean isDone()  
      boolean isSuccess()
      Returns true if and only if the I/O operation was completed successfully.
      T join()
      Returns the result value when complete, or throws an (unchecked) exception if completed exceptionally.
      void <? super > action)  
      <> <?> other,  action)  
      <> <?> other,  action)  
      <> <?> other,  action,  executor)  
      <> <?> other,  action)  
      <> <?> other,  action)  
      <> <?> other,  action,  executor)  
      boolean setUncancellable()
      Make this future impossible to cancel.
      RPromise<T> sync()
      Waits for this future until it is done, and rethrows the cause of the failure if this future failed.
      RPromise<T> syncUninterruptibly()
      Waits for this future until it is done, and rethrows the cause of the failure if this future failed.
      <> <? super T> action)  
      <> <? super T> action)  
      <> <? super T> action,  executor)  
      <U> <> <? extends U> other, <? super T,​? super U> action)  
      <U> <> <? extends U> other, <? super T,​? super U> action)  
      <U> <> <? extends U> other, <? super T,​? super U> action,  executor)  
      <U> <U> <? super T,​? extends U> fn)  
      <U> <U> <? super T,​? extends U> fn)  
      <U> <U> <? super T,​? extends U> fn,  executor)  
      <U,​V>
      <V>
      <? extends U> other, <? super T,​? super U,​? extends V> fn)  
      <U,​V>
      <V>
      <? extends U> other, <? super T,​? super U,​? extends V> fn)  
      <U,​V>
      <V>
      <? extends U> other, <? super T,​? super U,​? extends V> fn,  executor)  
      <U> <U> <? super <U>> fn)  
      <U> <U> <? super <U>> fn)  
      <U> <U> <? super <U>> fn,  executor)  
      <>  action)  
      <>  action)  
      <>  action,  executor)  
      <T> toCompletableFuture()  
      boolean  cause)
      Marks this future as a failure and notifies all listeners.
      boolean trySuccess​(T result)
      Marks this future as a success and notifies all listeners.
      <T> <? super > action)  
      <T> <? super > action)  
      <T> <? super > action,  executor)  
      • Methods inherited from class java.lang.

        , , , , , , , , , ,
    • Constructor Detail

      • PromiseDelegator

        public PromiseDelegator​(RPromise<T> promise)
    • Method Detail

      • getInnerPromise

        public RPromise<T> getInnerPromise()
      • join

        public T join()
        Description copied from interface: RFuture
        Returns the result value when complete, or throws an (unchecked) exception if completed exceptionally. To better conform with the use of common functional forms, if a computation involved in the completion of this CompletableFuture threw an exception.
        Specified by:
        join in interface RFuture<T>
        Returns:
        the result value
      • isSuccess

        public boolean isSuccess()
        Description copied from interface: RFuture
        Returns true if and only if the I/O operation was completed successfully.
        Specified by:
        isSuccess in interface RFuture<T>
        Returns:
        true if future was completed successfully
      • trySuccess

        public boolean trySuccess​(T result)
        Description copied from interface: RPromise
        Marks this future as a success and notifies all listeners.
        Specified by:
        trySuccess in interface RPromise<T>
        Parameters:
        result - object
        Returns:
        true if and only if successfully marked this future as a success. Otherwise false because this future is already marked as either a success or a failure.
      • cause

        public  cause()
        Description copied from interface: RFuture
        Returns the cause of the failed I/O operation if the I/O operation has failed.
        Specified by:
        cause in interface RFuture<T>
        Returns:
        the cause of the failure. null if succeeded or this future is not completed yet.
      • getNow

        public T getNow()
        Description copied from interface: RFuture
        Return the result without blocking. If the future is not done yet this will return null. As it is possible that a null value is used to mark the future as successful you also need to check if the future is really done with and not relay on the returned null value.
        Specified by:
        getNow in interface RFuture<T>
        Returns:
        object
      • tryFailure

        public boolean tryFailure​( cause)
        Description copied from interface: RPromise
        Marks this future as a failure and notifies all listeners.
        Specified by:
        tryFailure in interface RPromise<T>
        Parameters:
        cause - object
        Returns:
        true if and only if successfully marked this future as a failure. Otherwise false because this future is already marked as either a success or a failure.
      • await

        public boolean await​(long timeout,
                              unit)
                      throws 
        Description copied from interface: RFuture
        Waits for this future to be completed within the specified time limit.
        Specified by:
        await in interface RFuture<T>
        Parameters:
        timeout - - wait timeout
        unit - - time unit
        Returns:
        true if and only if the future was completed within the specified time limit
        Throws:
        - if the current thread was interrupted
      • setUncancellable

        public boolean setUncancellable()
        Description copied from interface: RPromise
        Make this future impossible to cancel.
        Specified by:
        setUncancellable in interface RPromise<T>
        Returns:
        true if and only if successfully marked this future as uncancellable or it is already done without being cancelled. false if this future has been cancelled already.
      • await

        public boolean await​(long timeoutMillis)
                      throws 
        Description copied from interface: RFuture
        Waits for this future to be completed within the specified time limit.
        Specified by:
        await in interface RFuture<T>
        Parameters:
        timeoutMillis - - timeout value
        Returns:
        true if and only if the future was completed within the specified time limit
        Throws:
        - if the current thread was interrupted
      • await

        public RPromise<T> await()
                          throws 
        Description copied from interface: RFuture
        Waits for this future to be completed.
        Specified by:
        await in interface RFuture<T>
        Specified by:
        await in interface RPromise<T>
        Returns:
        Future object
        Throws:
        - if the current thread was interrupted
      • cancel

        public boolean cancel​(boolean mayInterruptIfRunning)
        Specified by:
         in interface <T>
      • awaitUninterruptibly

        public RPromise<T> awaitUninterruptibly()
        Description copied from interface: RFuture
        Waits for this future to be completed without interruption. This method catches an and discards it silently.
        Specified by:
        awaitUninterruptibly in interface RFuture<T>
        Specified by:
        awaitUninterruptibly in interface RPromise<T>
        Returns:
        Future object
      • sync

        public RPromise<T> sync()
                         throws 
        Description copied from interface: RFuture
        Waits for this future until it is done, and rethrows the cause of the failure if this future failed.
        Specified by:
        sync in interface RFuture<T>
        Specified by:
        sync in interface RPromise<T>
        Returns:
        Future object
        Throws:
        - if the current thread was interrupted
      • isCancelled

        public boolean isCancelled()
        Specified by:
         in interface <T>
      • isDone

        public boolean isDone()
        Specified by:
         in interface <T>
      • get

        public T get()
              throws ,
                     
        Specified by:
         in interface <T>
        Throws:
      • awaitUninterruptibly

        public boolean awaitUninterruptibly​(long timeout,
                                             unit)
        Description copied from interface: RFuture
        Waits for this future to be completed within the specified time limit without interruption. This method catches an and discards it silently.
        Specified by:
        awaitUninterruptibly in interface RFuture<T>
        Parameters:
        timeout - - timeout value
        unit - - timeout unit value
        Returns:
        true if and only if the future was completed within the specified time limit
      • get

        public T get​(long timeout,
                      unit)
              throws ,
                     ,
                     
        Specified by:
         in interface <T>
        Throws:
      • thenApply

        public <U> <U> thenApply​(<? super T,​? extends U> fn)
        Specified by:
         in interface <T>
      • awaitUninterruptibly

        public boolean awaitUninterruptibly​(long timeoutMillis)
        Description copied from interface: RFuture
        Waits for this future to be completed within the specified time limit without interruption. This method catches an and discards it silently.
        Specified by:
        awaitUninterruptibly in interface RFuture<T>
        Parameters:
        timeoutMillis - - timeout value
        Returns:
        true if and only if the future was completed within the specified time limit
      • thenApplyAsync

        public <U> <U> thenApplyAsync​(<? super T,​? extends U> fn)
        Specified by:
         in interface <T>
      • thenApplyAsync

        public <U> <U> thenApplyAsync​(<? super T,​? extends U> fn,
                                                      executor)
        Specified by:
         in interface <T>
      • thenAccept

        public <> thenAccept​(<? super T> action)
        Specified by:
         in interface <T>
      • thenAcceptAsync

        public <> thenAcceptAsync​(<? super T> action)
        Specified by:
         in interface <T>
      • thenAcceptAsync

        public <> thenAcceptAsync​(<? super T> action,
                                                      executor)
        Specified by:
         in interface <T>
      • thenRun

        public <> thenRun​( action)
        Specified by:
         in interface <T>
      • thenRunAsync

        public <> thenRunAsync​( action)
        Specified by:
         in interface <T>
      • thenRunAsync

        public <> thenRunAsync​( action,
                                                   executor)
        Specified by:
         in interface <T>
      • thenCombine

        public <U,​V> <V> thenCombine​(<? extends U> other,
                                                          <? super T,​? super U,​? extends V> fn)
        Specified by:
         in interface <T>
      • thenCombineAsync

        public <U,​V> <V> thenCombineAsync​(<? extends U> other,
                                                               <? super T,​? super U,​? extends V> fn)
        Specified by:
         in interface <T>
      • thenCombineAsync

        public <U,​V> <V> thenCombineAsync​(<? extends U> other,
                                                               <? super T,​? super U,​? extends V> fn,
                                                                executor)
        Specified by:
         in interface <T>
      • thenAcceptBoth

        public <U> <> thenAcceptBoth​(<? extends U> other,
                                                        <? super T,​? super U> action)
        Specified by:
         in interface <T>
      • thenAcceptBothAsync

        public <U> <> thenAcceptBothAsync​(<? extends U> other,
                                                             <? super T,​? super U> action)
        Specified by:
         in interface <T>
      • thenAcceptBothAsync

        public <U> <> thenAcceptBothAsync​(<? extends U> other,
                                                             <? super T,​? super U> action,
                                                              executor)
        Specified by:
         in interface <T>
      • runAfterBoth

        public <> runAfterBoth​(<?> other,
                                                   action)
        Specified by:
         in interface <T>
      • runAfterBothAsync

        public <> runAfterBothAsync​(<?> other,
                                                        action)
        Specified by:
         in interface <T>
      • runAfterBothAsync

        public <> runAfterBothAsync​(<?> other,
                                                        action,
                                                        executor)
        Specified by:
         in interface <T>
      • applyToEither

        public <U> <U> applyToEither​(<? extends T> other,
                                                    <? super T,​U> fn)
        Specified by:
         in interface <T>
      • applyToEitherAsync

        public <U> <U> applyToEitherAsync​(<? extends T> other,
                                                         <? super T,​U> fn)
        Specified by:
         in interface <T>
      • applyToEitherAsync

        public <U> <U> applyToEitherAsync​(<? extends T> other,
                                                         <? super T,​U> fn,
                                                          executor)
        Specified by:
         in interface <T>
      • acceptEither

        public <> acceptEither​(<? extends T> other,
                                                  <? super T> action)
        Specified by:
         in interface <T>
      • acceptEitherAsync

        public <> acceptEitherAsync​(<? extends T> other,
                                                       <? super T> action)
        Specified by:
         in interface <T>
      • acceptEitherAsync

        public <> acceptEitherAsync​(<? extends T> other,
                                                       <? super T> action,
                                                        executor)
        Specified by:
         in interface <T>
      • runAfterEither

        public <> runAfterEither​(<?> other,
                                                     action)
        Specified by:
         in interface <T>
      • runAfterEitherAsync

        public <> runAfterEitherAsync​(<?> other,
                                                          action)
        Specified by:
         in interface <T>
      • runAfterEitherAsync

        public <> runAfterEitherAsync​(<?> other,
                                                          action,
                                                          executor)
        Specified by:
         in interface <T>
      • thenCompose

        public <U> <U> thenCompose​(<? super <U>> fn)
        Specified by:
         in interface <T>
      • thenComposeAsync

        public <U> <U> thenComposeAsync​(<? super <U>> fn)
        Specified by:
         in interface <T>
      • thenComposeAsync

        public <U> <U> thenComposeAsync​(<? super <U>> fn,
                                                        executor)
        Specified by:
         in interface <T>
      • exceptionally

        public <<,​? extends T> fn)
        Specified by:
         in interface <T>
      • whenComplete

        public <<? super > action)
        Specified by:
         in interface <T>
      • whenCompleteAsync

        public <<? super > action)
        Specified by:
         in interface <T>
      • whenCompleteAsync

        public <<? super > action,
                                                     executor)
        Specified by:
         in interface <T>
      • handle

        public <U> <U> handle​(<? super ,​? extends U> fn)
        Specified by:
         in interface <T>
      • handleAsync

        public <U> <U> handleAsync​(<? super ,​? extends U> fn)
        Specified by:
         in interface <T>
      • handleAsync

        public <U> <U> handleAsync​(<? super ,​? extends U> fn,
                                                   executor)
        Specified by:
         in interface <T>
      • toCompletableFuture

        public <T> toCompletableFuture()
        Specified by:
         in interface <T>
      • onComplete

        public void onComplete​(<? super > action)
        Specified by:
        onComplete in interface RFuture<T>