ComplexFutureAction (Spark 4.2.0 JavaDoc)
org.apache.spark.ComplexFutureAction<T>
- All Implemented Interfaces:
FutureAction<T>,scala.concurrent.Awaitable<T>,scala.concurrent.Future<T>
public class ComplexFutureAction<T> extends Object implements FutureAction<T>
A FutureAction for actions that could trigger multiple Spark jobs. Examples include take,
takeSample. Cancellation works by setting the cancelled flag to true and cancelling any pending
jobs.
-
Nested Class Summary
Nested classes/interfaces inherited from interface scala.concurrent.Future
scala.concurrent.Future.never$ -
Constructor Summary
Constructors
-
Method Summary
voidcancel(scala.Option<String> reason) Cancels the execution of this action with an optional reason.
booleanReturns whether the action has been cancelled.
booleanReturns 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> voidonComplete(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.
<S> scala.concurrent.Future<S>transform(scala.Function1<scala.util.Try<T>, scala.util.Try<S>> f, scala.concurrent.ExecutionContext e) <S> scala.concurrent.Future<S>transformWith(scala.Function1<scala.util.Try<T>, scala.concurrent.Future<S>> f, scala.concurrent.ExecutionContext e) 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, withFilter, zip, zipWith
-
Constructor Details
-
ComplexFutureAction
public ComplexFutureAction
(scala.Function1<JobSubmitter, scala.concurrent.Future<T>> run)
-
-
Method Details
-
cancel
public void cancel
(scala.Option<String> reason) Cancels the execution of this action with an optional reason.
- Specified by:
cancelin interfaceFutureAction<T>- Parameters:
reason- (undocumented)
-
isCancelled
public boolean isCancelled()
Returns whether the action has been cancelled.
- Specified by:
isCancelledin interfaceFutureAction<T>- Returns:
- (undocumented)
-
isCompleted
public boolean isCompleted()
Returns whether the action has already been completed with a value or an exception.
- Specified by:
isCompletedin interfacescala.concurrent.Future<T>- Specified by:
isCompletedin interfaceFutureAction<T>- Returns:
- (undocumented)
-
jobIds
public 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.
- Specified by:
jobIdsin interfaceFutureAction<T>- Returns:
- (undocumented)
-
onComplete
public <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:
onCompletein interfacescala.concurrent.Future<T>- Specified by:
onCompletein interfaceFutureAction<T>- Parameters:
func- (undocumented)executor- (undocumented)
-
ready
Blocks until this action completes.
- Specified by:
readyin interfacescala.concurrent.Awaitable<T>- Specified by:
readyin interfaceFutureAction<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
- Throws:
InterruptedExceptionTimeoutException
-
result
public 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:
resultin interfacescala.concurrent.Awaitable<T>- Specified by:
resultin interfaceFutureAction<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
-
transform
public <S> scala.concurrent.Future<S> transform
(scala.Function1<scala.util.Try<T>, scala.util.Try<S>> f, scala.concurrent.ExecutionContext e) - Specified by:
transformin interfacescala.concurrent.Future<T>
-
transformWith
public <S> scala.concurrent.Future<S> transformWith
(scala.Function1<scala.util.Try<T>, scala.concurrent.Future<S>> f, scala.concurrent.ExecutionContext e) - Specified by:
transformWithin interfacescala.concurrent.Future<T>
-
value
public 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:
valuein interfacescala.concurrent.Future<T>- Specified by:
valuein interfaceFutureAction<T>- Returns:
- (undocumented)
-