Package org.apache.spark
Interface FutureAction<T>
- All Superinterfaces:
scala.concurrent.Awaitable<T>
,scala.concurrent.Future<T>
- All Known Implementing Classes:
ComplexFutureAction
,SimpleFutureAction
public interface FutureAction<T>
extends scala.concurrent.Future<T>
A future for the result of an action to support cancellation. This is an extension of the
Scala Future interface to support cancellation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface scala.concurrent.Future
scala.concurrent.Future.never$
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancels the execution of this action.void
Cancels the execution of this action with an optional reason.get()
Blocks and returns the result of this job.boolean
Returns whether the action has been cancelled.boolean
Returns whether the action has already been completed with a value or an exception.scala.collection.immutable.Seq<Object>
jobIds()
Returns the job IDs run by the underlying async operation.<U> void
onComplete
(scala.Function1<scala.util.Try<T>, U> func, scala.concurrent.ExecutionContext executor) When this action is completed, either through an exception, or a value, applies the provided function.ready
(scala.concurrent.duration.Duration atMost, scala.concurrent.CanAwait permit) Blocks until this action completes.result
(scala.concurrent.duration.Duration atMost, scala.concurrent.CanAwait permit) Awaits and returns the result (of type T) of this action.scala.Option<scala.util.Try<T>>
value()
The value of this Future.Methods inherited from interface scala.concurrent.Future
andThen, collect, failed, fallbackTo, filter, flatMap, flatten, foreach, map, mapTo, recover, recoverWith, transform, transform, transformWith, withFilter, zip, zipWith
-
Method Details
-
cancel
Cancels the execution of this action with an optional reason.- Parameters:
reason
- (undocumented)
-
cancel
void cancel()Cancels the execution of this action. -
get
Blocks and returns the result of this job.- Returns:
- (undocumented)
- Throws:
SparkException
-
isCancelled
boolean isCancelled()Returns whether the action has been cancelled.- Returns:
- (undocumented)
-
isCompleted
boolean isCompleted()Returns whether the action has already been completed with a value or an exception.- Specified by:
isCompleted
in interfacescala.concurrent.Future<T>
- Returns:
- (undocumented)
-
jobIds
scala.collection.immutable.Seq<Object> jobIds()Returns the job IDs run by the underlying async operation.This returns the current snapshot of the job list. Certain operations may run multiple jobs, so multiple calls to this method may return different lists.
- Returns:
- (undocumented)
-
onComplete
<U> void onComplete(scala.Function1<scala.util.Try<T>, U> func, scala.concurrent.ExecutionContext executor) When this action is completed, either through an exception, or a value, applies the provided function.- Specified by:
onComplete
in interfacescala.concurrent.Future<T>
- Parameters:
func
- (undocumented)executor
- (undocumented)
-
ready
Blocks until this action completes.- Specified by:
ready
in interfacescala.concurrent.Awaitable<T>
- Parameters:
atMost
- maximum wait time, which may be negative (no waiting is done), Duration.Inf for unbounded waiting, or a finite positive durationpermit
- (undocumented)- Returns:
- this FutureAction
-
result
T result(scala.concurrent.duration.Duration atMost, scala.concurrent.CanAwait permit) throws Exception Awaits and returns the result (of type T) of this action.- Specified by:
result
in interfacescala.concurrent.Awaitable<T>
- Parameters:
atMost
- maximum wait time, which may be negative (no waiting is done), Duration.Inf for unbounded waiting, or a finite positive durationpermit
- (undocumented)- Returns:
- the result value if the action is completed within the specific maximum wait time
- Throws:
Exception
- exception during action execution
-
value
scala.Option<scala.util.Try<T>> value()The value of this Future.If the future is not completed the returned value will be None. If the future is completed the value will be Some(Success(t)) if it contains a valid result, or Some(Failure(error)) if it contains an exception.
- Specified by:
value
in interfacescala.concurrent.Future<T>
- Returns:
- (undocumented)
-