V - the type of the returned value of the submitted functionpublic static final class AbstractTaskExecutor.SubmittedTask<V> extends Object
AbstractTaskExecutor.
Implementations of AbstractTaskExecutor must eventually complete the SubmittedTask
in a way: execute,
completeExceptionally or cancel.
| Constructor and Description |
|---|
SubmittedTask(CancelableFunction<? extends V> function)
Creates a new
SubmittedTask with the given underlying function. |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Completes the submitted task exceptionally with an
OperationCanceledException. |
void |
completeExceptionally(Throwable ex)
Completes the submitted task exceptionally with the given exception.
|
void |
execute(CancellationToken cancelToken)
Executes the submitted tasks and completes this
SubmittedTask. |
CompletableFuture<V> |
getFuture()
Returns the future of the submitted task.
|
public SubmittedTask(CancelableFunction<? extends V> function)
SubmittedTask with the given underlying function.function - the actual function to be calculated. This argument cannot be
null.public void execute(CancellationToken cancelToken)
SubmittedTask. This method
never throws an exception. If the submitted task fails, the task will be completed
exceptionally.cancelToken - the CancellationToken passed to the submitted task.
This argument cannot be null.public CompletableFuture<V> getFuture()
null.public void completeExceptionally(Throwable ex)
ex - the exception to complete the submitted task with. This argument
cannot be null.public void cancel()
OperationCanceledException.