T - type of the future's valuepublic class FlinkFuture<T> extends Object implements Future<T>
Future which is backed by Future.| Modifier and Type | Field and Description |
|---|---|
protected scala.concurrent.Future<T> |
scalaFuture |
| Constructor and Description |
|---|
FlinkFuture(scala.concurrent.Future<T> scalaFuture) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
Tries to cancel the future's operation.
|
<R> Future<R> |
exceptionally(ApplyFunction<Throwable,? extends R> exceptionallyFunction)
Applies the given function to the value of the future if the future has been completed
exceptionally.
|
<R> Future<R> |
exceptionallyAsync(ApplyFunction<Throwable,? extends R> exceptionallyFunction,
Executor executor)
Applies the given function to the value of the future if the future has been completed
exceptionally.
|
T |
get()
Gets the result value of the future.
|
T |
get(long timeout,
TimeUnit unit)
Gets the result value of the future.
|
T |
getNow(T valueIfAbsent)
Gets the value of the future.
|
scala.concurrent.Future<T> |
getScalaFuture() |
<R> Future<R> |
handle(BiFunction<? super T,Throwable,? extends R> biFunction)
Applies the given handle function to the result of the future.
|
<R> Future<R> |
handleAsync(BiFunction<? super T,Throwable,? extends R> biFunction,
Executor executor)
Applies the given handle function to the result of the future.
|
boolean |
isDone()
Checks if the future has been completed.
|
static <T> Future<T> |
supplyAsync(Callable<T> callable,
Executor executor)
Creates a future whose value is determined by the asynchronously executed callable.
|
Future<Void> |
thenAccept(AcceptFunction<? super T> acceptFunction)
Applies the accept function to the value of the future.
|
Future<Void> |
thenAcceptAsync(AcceptFunction<? super T> acceptFunction,
Executor executor)
Applies the accept function to the value of the future.
|
<R> Future<R> |
thenApply(ApplyFunction<? super T,? extends R> applyFunction)
Applies the given function to the value of the future.
|
<R> Future<R> |
thenApplyAsync(ApplyFunction<? super T,? extends R> applyFunction,
Executor executor)
Applies the given function to the value of the future.
|
<U,R> Future<R> |
thenCombine(Future<U> other,
BiFunction<? super T,? super U,? extends R> biFunction)
Applies the given function to the result of this and the other future after both futures
have completed.
|
<U,R> Future<R> |
thenCombineAsync(Future<U> other,
BiFunction<? super T,? super U,? extends R> biFunction,
Executor executor)
Applies the given function to the result of this and the other future after both futures
have completed.
|
<R> Future<R> |
thenCompose(ApplyFunction<? super T,? extends Future<R>> composeFunction)
Applies the given function to the value of the future.
|
<R> Future<R> |
thenComposeAsync(ApplyFunction<? super T,? extends Future<R>> applyFunction,
Executor executor)
Applies the given function to the value of the future.
|
protected scala.concurrent.Future<T> scalaFuture
public FlinkFuture(scala.concurrent.Future<T> scalaFuture)
public scala.concurrent.Future<T> getScalaFuture()
public boolean isDone()
Futurepublic boolean cancel(boolean mayInterruptIfRunning)
Futurepublic T get() throws InterruptedException, ExecutionException
Futureget in interface Future<T>InterruptedException - if the current thread was interrupted while waiting for the resultExecutionException - if the future has been completed with an exceptionpublic T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
FutureTimeoutException.get in interface Future<T>timeout - the time to wait for the future to be doneunit - time unit for the timeout argumentInterruptedException - if the current thread was interrupted while waiting for the resultExecutionException - if the future has been completed with an exceptionTimeoutException - if the future has not been completed within the given timeoutpublic T getNow(T valueIfAbsent) throws ExecutionException
FuturegetNow in interface Future<T>valueIfAbsent - value which is returned if the future has not been completedExecutionException - if the future has been completed with an exceptionpublic <R> Future<R> thenApplyAsync(ApplyFunction<? super T,? extends R> applyFunction, Executor executor)
FutureThe apply function is executed asynchronously by the given executor.
thenApplyAsync in interface Future<T>R - type of the apply function's return valueapplyFunction - function to apply to the future's valueexecutor - used to execute the given apply function asynchronouslypublic <R> Future<R> thenApply(ApplyFunction<? super T,? extends R> applyFunction)
Futurepublic Future<Void> thenAcceptAsync(AcceptFunction<? super T> acceptFunction, Executor executor)
FutureApplyFunction, the
AcceptFunction does not return a value. The returned future, thus, represents only
the completion of the accept callback.
The accept function is executed asynchronously by the given executor.
thenAcceptAsync in interface Future<T>acceptFunction - function to apply to the future's valueexecutor - used to execute the given apply function asynchronouslypublic Future<Void> thenAccept(AcceptFunction<? super T> acceptFunction)
FutureApplyFunction, the
AcceptFunction does not return a value. The returned future, thus, represents only
the completion of the accept callback.thenAccept in interface Future<T>acceptFunction - function to apply to the future's valuepublic <R> Future<R> exceptionallyAsync(ApplyFunction<Throwable,? extends R> exceptionallyFunction, Executor executor)
FutureThe apply function is executed asynchronously by the given executor.
exceptionallyAsync in interface Future<T>R - type of the apply function's return valueexceptionallyFunction - to apply to the future's value if it is an exceptionexecutor - used to execute the given apply function asynchronouslypublic <R> Future<R> exceptionally(ApplyFunction<Throwable,? extends R> exceptionallyFunction)
Futureexceptionally in interface Future<T>R - type of the apply function's return valueexceptionallyFunction - to apply to the future's value if it is an exceptionpublic <R> Future<R> thenComposeAsync(ApplyFunction<? super T,? extends Future<R>> applyFunction, Executor executor)
FutureThe apply function is executed asynchronously by the given executor.
thenComposeAsync in interface Future<T>R - type of the returned future's valueapplyFunction - to apply to the future's value. The function returns a future which is
flattenedexecutor - used to execute the given apply function asynchronouslypublic <R> Future<R> thenCompose(ApplyFunction<? super T,? extends Future<R>> composeFunction)
FuturethenCompose in interface Future<T>R - type of the returned future's valuecomposeFunction - to apply to the future's value. The function returns a future which is
flattenedpublic <R> Future<R> handleAsync(BiFunction<? super T,Throwable,? extends R> biFunction, Executor executor)
FutureThe handle function is executed asynchronously by the given executor.
handleAsync in interface Future<T>R - type of the handle function's return valuebiFunction - applied to the result (normal and exceptional) of the futureexecutor - used to execute the handle function asynchronouslypublic <R> Future<R> handle(BiFunction<? super T,Throwable,? extends R> biFunction)
Futurepublic <U,R> Future<R> thenCombineAsync(Future<U> other, BiFunction<? super T,? super U,? extends R> biFunction, Executor executor)
FutureThe bi-function is executed asynchronously by the given executor.
thenCombineAsync in interface Future<T>U - type of that future's return valueR - type of the bi-function's return valueother - future whose result is the right input to the bi-functionbiFunction - applied to the result of this and that futureexecutor - used to execute the bi-function asynchronouslypublic <U,R> Future<R> thenCombine(Future<U> other, BiFunction<? super T,? super U,? extends R> biFunction)
FuturethenCombine in interface Future<T>U - type of that future's return valueR - type of the bi-function's return valueother - future whose result is the right input to the bi-functionbiFunction - applied to the result of this and that futurepublic static <T> Future<T> supplyAsync(Callable<T> callable, Executor executor)
T - type of the future's valuecallable - whose value is delivered by the futureexecutor - to be used to execute the callableCopyright © 2014–2017 The Apache Software Foundation. All rights reserved.