Class PromiseDelegator<T>

    • Constructor Detail

      • PromiseDelegator

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

      • getInnerPromise

        public RPromise<T> getInnerPromise()
      • 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 Throwable 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.
      • tryFailure

        public boolean tryFailure​(Throwable 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.
      • 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.
      • addListener

        public RPromise<T> addListener​(io.netty.util.concurrent.FutureListener<? super T> listener)
        Description copied from interface: RFuture
        Adds the specified listener to this future. The specified listener is notified when this future is done. If this future is already completed, the specified listener is notified immediately.
        Specified by:
        addListener in interface RFuture<T>
        Specified by:
        addListener in interface RPromise<T>
        Parameters:
        listener - - listener for future object
        Returns:
        Future object
      • addListeners

        public RPromise<T> addListeners​(io.netty.util.concurrent.FutureListener<? super T>... listeners)
        Description copied from interface: RFuture
        Adds the specified listeners to this future. The specified listeners are notified when this future is done. If this future is already completed, the specified listeners are notified immediately.
        Specified by:
        addListeners in interface RFuture<T>
        Specified by:
        addListeners in interface RPromise<T>
        Parameters:
        listeners - - listeners for future object
        Returns:
        Future object
      • removeListener

        public RPromise<T> removeListener​(io.netty.util.concurrent.FutureListener<? super T> listener)
        Description copied from interface: RFuture
        Removes the first occurrence of the specified listener from this future. The specified listener is no longer notified when this future is done. If the specified listener is not associated with this future, this method does nothing and returns silently.
        Specified by:
        removeListener in interface RFuture<T>
        Specified by:
        removeListener in interface RPromise<T>
        Parameters:
        listener - - listener for future object
        Returns:
        Future object
      • removeListeners

        public RPromise<T> removeListeners​(io.netty.util.concurrent.FutureListener<? super T>... listeners)
        Description copied from interface: RFuture
        Removes the first occurrence for each of the listeners from this future. The specified listeners are no longer notified when this future is done. If the specified listeners are not associated with this future, this method does nothing and returns silently.
        Specified by:
        removeListeners in interface RFuture<T>
        Specified by:
        removeListeners in interface RPromise<T>
        Parameters:
        listeners - - listeners for future object
        Returns:
        Future object
      • await

        public boolean await​(long timeout,
                             TimeUnit unit)
                      throws InterruptedException
        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:
        InterruptedException - if the current thread was interrupted
      • isCancelled

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

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

        public boolean await​(long timeoutMillis)
                      throws InterruptedException
        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:
        InterruptedException - if the current thread was interrupted
      • awaitUninterruptibly

        public boolean awaitUninterruptibly​(long timeout,
                                            TimeUnit unit)
        Description copied from interface: RFuture
        Waits for this future to be completed within the specified time limit without interruption. This method catches an InterruptedException 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
      • 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 InterruptedException 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
      • 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 Future.isDone() and not relay on the returned null value.
        Specified by:
        getNow in interface RFuture<T>
        Returns:
        object
      • cancel

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