public final class VortexFuture<TOutput> extends Object implements Future<TOutput>, VortexFutureDelegate
Constructor and Description |
---|
VortexFuture(Executor executor,
VortexMaster vortexMaster,
int taskletId,
Codec<TOutput> outputCodec)
Creates a
VortexFuture . |
VortexFuture(Executor executor,
VortexMaster vortexMaster,
int taskletId,
Codec<TOutput> outputCodec,
FutureCallback<TOutput> callbackHandler)
Creates a
VortexFuture with a callback. |
Modifier and Type | Method and Description |
---|---|
void |
aggregationCompleted(List<Integer> taskletIds,
byte[] serializedResult)
VortexMaster should never call this.
|
void |
aggregationThrewException(List<Integer> taskletIds,
Exception exception)
VortexMaster should never call this.
|
boolean |
cancel(boolean mayInterruptIfRunning)
Sends a cancel signal and blocks and waits until the task is cancelled, completed, or failed.
|
boolean |
cancel(boolean mayInterruptIfRunning,
long timeout,
TimeUnit unit)
Sends a cancel signal and blocks and waits until the task is cancelled, completed, or failed, or
if the timeout has expired.
|
void |
cancelled(int pTaskletId)
Called by VortexMaster to let the user know that the Tasklet was cancelled.
|
void |
completed(int pTaskletId,
byte[] serializedResult)
Called by VortexMaster to let the user know that the Tasklet completed.
|
TOutput |
get()
Infinitely wait for the result of the task.
|
TOutput |
get(long timeout,
TimeUnit unit)
Wait a certain period of time for the result of the task.
|
boolean |
isCancelled() |
boolean |
isDone() |
void |
threwException(int pTaskletId,
Exception exception)
Called by VortexMaster to let the user know that the Tasklet threw an exception.
|
public VortexFuture(Executor executor, VortexMaster vortexMaster, int taskletId, Codec<TOutput> outputCodec)
VortexFuture
.public VortexFuture(Executor executor, VortexMaster vortexMaster, int taskletId, Codec<TOutput> outputCodec, FutureCallback<TOutput> callbackHandler)
VortexFuture
with a callback.public boolean cancel(boolean mayInterruptIfRunning)
public boolean cancel(boolean mayInterruptIfRunning, long timeout, TimeUnit unit) throws TimeoutException
TimeoutException
public boolean isCancelled()
isCancelled
in interface Future<TOutput>
public boolean isDone()
public TOutput get() throws InterruptedException, ExecutionException, CancellationException
get
in interface Future<TOutput>
InterruptedException
- if the thread is interrupted.ExecutionException
- if the Tasklet execution failed to complete.CancellationException
- if the Tasklet was cancelled.public TOutput get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException, CancellationException
get
in interface Future<TOutput>
TimeoutException
- if the timeout provided hits before the Tasklet is done.InterruptedException
- if the thread is interrupted.ExecutionException
- if the Tasklet execution failed to complete.CancellationException
- if the Tasklet was cancelled.public void completed(int pTaskletId, byte[] serializedResult)
completed
in interface VortexFutureDelegate
public void aggregationCompleted(List<Integer> taskletIds, byte[] serializedResult)
aggregationCompleted
in interface VortexFutureDelegate
public void threwException(int pTaskletId, Exception exception)
threwException
in interface VortexFutureDelegate
public void aggregationThrewException(List<Integer> taskletIds, Exception exception)
aggregationThrewException
in interface VortexFutureDelegate
public void cancelled(int pTaskletId)
cancelled
in interface VortexFutureDelegate
Copyright © 2016 The Apache Software Foundation. All rights reserved.