Interface AsyncFuture<T>
-
- Type Parameters:
T- The return type of this future.
- All Superinterfaces:
org.apache.flink.api.common.state.v2.StateFuture<T>
- All Known Subinterfaces:
InternalAsyncFuture<T>
- All Known Implementing Classes:
AsyncFutureImpl,CompletedAsyncFuture
@Internal public interface AsyncFuture<T> extends org.apache.flink.api.common.state.v2.StateFuture<T>AsyncFuture is a future that act as a return value for async state interfaces. Currently, this is a copy ofStateFuturewith override all methods' signature. There is no good reason to do this, but we need to do keep theStateFutureinterface as a public API.TODO: Rename
StateFuturetoAsyncFutureand remove this interface. If we decided to exposeAsyncFutureas a public API.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AsyncFuture<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> AsyncFuture<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>
AsyncFuture<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> AsyncFuture<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.AsyncFuture<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.AsyncFuture<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> AsyncFuture<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>
AsyncFuture<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> AsyncFuture<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>
AsyncFuture<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.
-
-
-
Method Detail
-
thenApply
<U> AsyncFuture<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:
thenApplyin interfaceorg.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
AsyncFuture<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:
thenAcceptin interfaceorg.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> AsyncFuture<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:
thenComposein interfaceorg.apache.flink.api.common.state.v2.StateFuture<T>- Parameters:
action- the action to perform.- Returns:
- the new StateFuture.
-
thenCombine
<U,V> AsyncFuture<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:
thenCombinein interfaceorg.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> AsyncFuture<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 thethenApply(FunctionWithException).- Specified by:
thenConditionallyApplyin interfaceorg.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> AsyncFuture<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 thethenApply(FunctionWithException).- Specified by:
thenConditionallyApplyin interfaceorg.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
AsyncFuture<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:
thenConditionallyAcceptin interfaceorg.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
AsyncFuture<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:
thenConditionallyAcceptin interfaceorg.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> AsyncFuture<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 thethenCompose(FunctionWithException).- Specified by:
thenConditionallyComposein interfaceorg.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> AsyncFuture<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 thethenCompose(FunctionWithException)(FunctionWithException)}.- Specified by:
thenConditionallyComposein interfaceorg.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.
-
-