Interface InternalAsyncFuture<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void complete​(T result)
      Complete this future.
      void completeExceptionally​(String message, Throwable ex)
      Fail this future and pass the given exception to the runtime.
      T get()
      Waits if necessary for the computation to complete, and then retrieves its result.
      boolean isDone()
      Returns true if completed in any fashion: normally, exceptionally, or via cancellation.
      InternalAsyncFuture<Void> thenAccept​(org.apache.flink.util.function.ThrowingConsumer<? super T,​? extends Exception> action)
      Returns a new StateFuture that, when this future completes normally, is executed with this future's result as the argument to the supplied action.
      <U> InternalAsyncFuture<U> thenApply​(org.apache.flink.util.function.FunctionWithException<? super T,​? extends U,​? extends Exception> fn)
      Returns a new StateFuture that, when this future completes normally, is executed with this future's result as the argument to the supplied function.
      <U,​V>
      InternalAsyncFuture<V>
      thenCombine​(org.apache.flink.api.common.state.v2.StateFuture<? extends U> other, org.apache.flink.util.function.BiFunctionWithException<? super T,​? super U,​? extends V,​? extends Exception> fn)
      Returns a new StateFuture that, when this and the other given future both complete normally, is executed with the two results as arguments to the supplied function.
      <U> InternalAsyncFuture<U> thenCompose​(org.apache.flink.util.function.FunctionWithException<? super T,​? extends org.apache.flink.api.common.state.v2.StateFuture<U>,​? extends Exception> action)
      Returns a new future that, when this future completes normally, is executed with this future as the argument to the supplied function.
      InternalAsyncFuture<Boolean> thenConditionallyAccept​(org.apache.flink.util.function.FunctionWithException<? super T,​Boolean,​? extends Exception> condition, org.apache.flink.util.function.ThrowingConsumer<? super T,​? extends Exception> actionIfTrue)
      Apply a condition test on the result of this StateFuture, and try to perform the action if test result is true.
      InternalAsyncFuture<Boolean> thenConditionallyAccept​(org.apache.flink.util.function.FunctionWithException<? super T,​Boolean,​? extends Exception> condition, org.apache.flink.util.function.ThrowingConsumer<? super T,​? extends Exception> actionIfTrue, org.apache.flink.util.function.ThrowingConsumer<? super T,​? extends Exception> actionIfFalse)
      Apply a condition test on the result of this StateFuture, and try to perform one action out of two based on the result.
      <U> InternalAsyncFuture<org.apache.flink.api.java.tuple.Tuple2<Boolean,​U>> thenConditionallyApply​(org.apache.flink.util.function.FunctionWithException<? super T,​Boolean,​? extends Exception> condition, org.apache.flink.util.function.FunctionWithException<? super T,​? extends U,​? extends Exception> actionIfTrue)
      Apply a condition test on the result of this StateFuture, and try to perform the action if test result is true.
      <U,​V>
      InternalAsyncFuture<org.apache.flink.api.java.tuple.Tuple2<Boolean,​Object>>
      thenConditionallyApply​(org.apache.flink.util.function.FunctionWithException<? super T,​Boolean,​? extends Exception> condition, org.apache.flink.util.function.FunctionWithException<? super T,​? extends U,​? extends Exception> actionIfTrue, org.apache.flink.util.function.FunctionWithException<? super T,​? extends V,​? extends Exception> actionIfFalse)
      Apply a condition test on the result of this StateFuture, and try to perform one action out of two based on the result.
      <U> InternalAsyncFuture<org.apache.flink.api.java.tuple.Tuple2<Boolean,​U>> thenConditionallyCompose​(org.apache.flink.util.function.FunctionWithException<? super T,​Boolean,​? extends Exception> condition, org.apache.flink.util.function.FunctionWithException<? super T,​? extends org.apache.flink.api.common.state.v2.StateFuture<U>,​? extends Exception> actionIfTrue)
      Apply a condition test on the result of this StateFuture, and try to perform the action if test result is true.
      <U,​V>
      InternalAsyncFuture<org.apache.flink.api.java.tuple.Tuple2<Boolean,​Object>>
      thenConditionallyCompose​(org.apache.flink.util.function.FunctionWithException<? super T,​Boolean,​? extends Exception> condition, org.apache.flink.util.function.FunctionWithException<? super T,​? extends org.apache.flink.api.common.state.v2.StateFuture<U>,​? extends Exception> actionIfTrue, org.apache.flink.util.function.FunctionWithException<? super T,​? extends org.apache.flink.api.common.state.v2.StateFuture<V>,​? extends Exception> actionIfFalse)
      Apply a condition test on the result of this StateFuture, and try to perform one action out of two based on the result.
      void thenSyncAccept​(org.apache.flink.util.function.ThrowingConsumer<? super T,​? extends Exception> action)
      Accept the action in the same thread with the one of complete (or current thread if it has been completed).
    • Method Detail

      • isDone

        boolean isDone()
        Returns true if completed in any fashion: normally, exceptionally, or via cancellation.
        Returns:
        true if completed
      • get

        T get()
        Waits if necessary for the computation to complete, and then retrieves its result.
      • complete

        void complete​(T result)
        Complete this future.
      • completeExceptionally

        void completeExceptionally​(String message,
                                   Throwable ex)
        Fail this future and pass the given exception to the runtime.
        Parameters:
        message - the description of this exception
        ex - the exception
      • thenSyncAccept

        void thenSyncAccept​(org.apache.flink.util.function.ThrowingConsumer<? super T,​? extends Exception> action)
        Accept the action in the same thread with the one of complete (or current thread if it has been completed).
        Parameters:
        action - the action to perform.
      • thenApply

        <U> InternalAsyncFuture<U> thenApply​(org.apache.flink.util.function.FunctionWithException<? super T,​? extends U,​? extends Exception> fn)
        Returns a new StateFuture that, when this future completes normally, is executed with this future's result as the argument to the supplied function.
        Specified by:
        thenApply in interface AsyncFuture<T>
        Specified by:
        thenApply in interface org.apache.flink.api.common.state.v2.StateFuture<T>
        Type Parameters:
        U - the function's return type.
        Parameters:
        fn - the function to use to compute the value of the returned StateFuture.
        Returns:
        the new StateFuture.
      • thenAccept

        InternalAsyncFuture<Void> thenAccept​(org.apache.flink.util.function.ThrowingConsumer<? super T,​? extends Exception> action)
        Returns a new StateFuture that, when this future completes normally, is executed with this future's result as the argument to the supplied action.
        Specified by:
        thenAccept in interface AsyncFuture<T>
        Specified by:
        thenAccept in interface org.apache.flink.api.common.state.v2.StateFuture<T>
        Parameters:
        action - the action to perform before completing the returned StateFuture.
        Returns:
        the new StateFuture.
      • thenCompose

        <U> InternalAsyncFuture<U> thenCompose​(org.apache.flink.util.function.FunctionWithException<? super T,​? extends org.apache.flink.api.common.state.v2.StateFuture<U>,​? extends Exception> action)
        Returns a new future that, when this future completes normally, is executed with this future as the argument to the supplied function.
        Specified by:
        thenCompose in interface AsyncFuture<T>
        Specified by:
        thenCompose in interface org.apache.flink.api.common.state.v2.StateFuture<T>
        Parameters:
        action - the action to perform.
        Returns:
        the new StateFuture.
      • thenCombine

        <U,​V> InternalAsyncFuture<V> thenCombine​(org.apache.flink.api.common.state.v2.StateFuture<? extends U> other,
                                                       org.apache.flink.util.function.BiFunctionWithException<? super T,​? super U,​? extends V,​? extends Exception> fn)
        Returns a new StateFuture that, when this and the other given future both complete normally, is executed with the two results as arguments to the supplied function.
        Specified by:
        thenCombine in interface AsyncFuture<T>
        Specified by:
        thenCombine in interface org.apache.flink.api.common.state.v2.StateFuture<T>
        Type Parameters:
        U - the type of the other StateFuture's result.
        V - the function's return type.
        Parameters:
        other - the other StateFuture.
        fn - the function to use to compute the value of the returned StateFuture.
        Returns:
        the new StateFuture.
      • thenConditionallyApply

        <U,​V> InternalAsyncFuture<org.apache.flink.api.java.tuple.Tuple2<Boolean,​Object>> thenConditionallyApply​(org.apache.flink.util.function.FunctionWithException<? super T,​Boolean,​? extends Exception> condition,
                                                                                                                             org.apache.flink.util.function.FunctionWithException<? super T,​? extends U,​? extends Exception> actionIfTrue,
                                                                                                                             org.apache.flink.util.function.FunctionWithException<? super T,​? extends V,​? extends Exception> actionIfFalse)
        Apply a condition test on the result of this StateFuture, and try to perform one action out of two based on the result. Gather the results of the condition test and the selected action into a StateFuture of tuple. The relationship between the action result and the returned new StateFuture are just like the thenApply(FunctionWithException).
        Specified by:
        thenConditionallyApply in interface AsyncFuture<T>
        Specified by:
        thenConditionallyApply in interface org.apache.flink.api.common.state.v2.StateFuture<T>
        Type Parameters:
        U - the type of the output from actionIfTrue.
        V - the type of the output from actionIfFalse.
        Parameters:
        condition - the condition test.
        actionIfTrue - the function to apply if the condition returns true.
        actionIfFalse - the function to apply if the condition returns false.
        Returns:
        the new StateFuture with the result of condition test, and result of action.
      • thenConditionallyApply

        <U> InternalAsyncFuture<org.apache.flink.api.java.tuple.Tuple2<Boolean,​U>> thenConditionallyApply​(org.apache.flink.util.function.FunctionWithException<? super T,​Boolean,​? extends Exception> condition,
                                                                                                                org.apache.flink.util.function.FunctionWithException<? super T,​? extends U,​? extends Exception> actionIfTrue)
        Apply a condition test on the result of this StateFuture, and try to perform the action if test result is true. Gather the results of the condition test and the action (if applied) into a StateFuture of tuple. The relationship between the action result and the returned new StateFuture are just like the thenApply(FunctionWithException).
        Specified by:
        thenConditionallyApply in interface AsyncFuture<T>
        Specified by:
        thenConditionallyApply in interface org.apache.flink.api.common.state.v2.StateFuture<T>
        Type Parameters:
        U - the type of the output from actionIfTrue.
        Parameters:
        condition - the condition test.
        actionIfTrue - the function to apply if the condition returns true.
        Returns:
        the new StateFuture with the result of condition test, and result of action.
      • thenConditionallyAccept

        InternalAsyncFuture<Boolean> thenConditionallyAccept​(org.apache.flink.util.function.FunctionWithException<? super T,​Boolean,​? extends Exception> condition,
                                                             org.apache.flink.util.function.ThrowingConsumer<? super T,​? extends Exception> actionIfTrue,
                                                             org.apache.flink.util.function.ThrowingConsumer<? super T,​? extends Exception> actionIfFalse)
        Apply a condition test on the result of this StateFuture, and try to perform one action out of two based on the result. Gather the results of the condition test StateFuture.
        Specified by:
        thenConditionallyAccept in interface AsyncFuture<T>
        Specified by:
        thenConditionallyAccept in interface org.apache.flink.api.common.state.v2.StateFuture<T>
        Parameters:
        condition - the condition test.
        actionIfTrue - the function to apply if the condition returns true.
        actionIfFalse - the function to apply if the condition returns false.
        Returns:
        the new StateFuture.
      • thenConditionallyAccept

        InternalAsyncFuture<Boolean> thenConditionallyAccept​(org.apache.flink.util.function.FunctionWithException<? super T,​Boolean,​? extends Exception> condition,
                                                             org.apache.flink.util.function.ThrowingConsumer<? super T,​? extends Exception> actionIfTrue)
        Apply a condition test on the result of this StateFuture, and try to perform the action if test result is true. Gather the results of the condition test StateFuture.
        Specified by:
        thenConditionallyAccept in interface AsyncFuture<T>
        Specified by:
        thenConditionallyAccept in interface org.apache.flink.api.common.state.v2.StateFuture<T>
        Parameters:
        condition - the condition test.
        actionIfTrue - the function to apply if the condition returns true.
        Returns:
        the new StateFuture.
      • thenConditionallyCompose

        <U,​V> InternalAsyncFuture<org.apache.flink.api.java.tuple.Tuple2<Boolean,​Object>> thenConditionallyCompose​(org.apache.flink.util.function.FunctionWithException<? super T,​Boolean,​? extends Exception> condition,
                                                                                                                               org.apache.flink.util.function.FunctionWithException<? super T,​? extends org.apache.flink.api.common.state.v2.StateFuture<U>,​? extends Exception> actionIfTrue,
                                                                                                                               org.apache.flink.util.function.FunctionWithException<? super T,​? extends org.apache.flink.api.common.state.v2.StateFuture<V>,​? extends Exception> actionIfFalse)
        Apply a condition test on the result of this StateFuture, and try to perform one action out of two based on the result. Gather the results of the condition test and the selected action into a StateFuture of tuple. The relationship between the action result and the returned new StateFuture are just like the thenCompose(FunctionWithException).
        Specified by:
        thenConditionallyCompose in interface AsyncFuture<T>
        Specified by:
        thenConditionallyCompose in interface org.apache.flink.api.common.state.v2.StateFuture<T>
        Type Parameters:
        U - the type of the output from actionIfTrue.
        V - the type of the output from actionIfFalse.
        Parameters:
        condition - the condition test.
        actionIfTrue - the function to apply if the condition returns true.
        actionIfFalse - the function to apply if the condition returns false.
        Returns:
        the new StateFuture with the result of condition test, and result of action.
      • thenConditionallyCompose

        <U> InternalAsyncFuture<org.apache.flink.api.java.tuple.Tuple2<Boolean,​U>> thenConditionallyCompose​(org.apache.flink.util.function.FunctionWithException<? super T,​Boolean,​? extends Exception> condition,
                                                                                                                  org.apache.flink.util.function.FunctionWithException<? super T,​? extends org.apache.flink.api.common.state.v2.StateFuture<U>,​? extends Exception> actionIfTrue)
        Apply a condition test on the result of this StateFuture, and try to perform the action if test result is true. Gather the results of the condition test and the action (if applied) into a StateFuture of tuple. The relationship between the action result and the returned new StateFuture are just like the thenCompose(FunctionWithException) (FunctionWithException)}.
        Specified by:
        thenConditionallyCompose in interface AsyncFuture<T>
        Specified by:
        thenConditionallyCompose in interface org.apache.flink.api.common.state.v2.StateFuture<T>
        Type Parameters:
        U - the type of the output from actionIfTrue.
        Parameters:
        condition - the condition test.
        actionIfTrue - the function to apply if the condition returns true.
        Returns:
        the new StateFuture with the result of condition test, and result of action.