Interface InternalAsyncFuture<T>
-
- All Superinterfaces:
AsyncFuture<T>,org.apache.flink.api.common.state.v2.StateFuture<T>
- All Known Implementing Classes:
AsyncFutureImpl,CompletedAsyncFuture
@Internal public interface InternalAsyncFuture<T> extends AsyncFuture<T>
The Internal definition ofAsyncFuture, add some method that will be used by framework.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcomplete(T result)Complete this future.voidcompleteExceptionally(String message, Throwable ex)Fail this future and pass the given exception to the runtime.Tget()Waits if necessary for the computation to complete, and then retrieves its result.booleanisDone()Returnstrueif 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.voidthenSyncAccept(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()
Returnstrueif completed in any fashion: normally, exceptionally, or via cancellation.- Returns:
trueif 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 exceptionex- 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:
thenApplyin interfaceAsyncFuture<T>- 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
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:
thenAcceptin interfaceAsyncFuture<T>- 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> 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:
thenComposein interfaceAsyncFuture<T>- 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> 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:
thenCombinein interfaceAsyncFuture<T>- 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> 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 thethenApply(FunctionWithException).- Specified by:
thenConditionallyApplyin interfaceAsyncFuture<T>- 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> 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 thethenApply(FunctionWithException).- Specified by:
thenConditionallyApplyin interfaceAsyncFuture<T>- 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
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:
thenConditionallyAcceptin interfaceAsyncFuture<T>- 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
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:
thenConditionallyAcceptin interfaceAsyncFuture<T>- 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> 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 thethenCompose(FunctionWithException).- Specified by:
thenConditionallyComposein interfaceAsyncFuture<T>- 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> 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 thethenCompose(FunctionWithException)(FunctionWithException)}.- Specified by:
thenConditionallyComposein interfaceAsyncFuture<T>- 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.
-
-