Class TaskPool.Builder<I>
java.lang.Object
org.apache.hadoop.util.functional.TaskPool.Builder<I>
- Type Parameters:
I- item type
- Enclosing class:
- TaskPool
Builder for task execution.
-
Method Summary
Modifier and TypeMethodDescriptionabortWith(TaskPool.Task<I, ?> task) Task to abort with after another task failed.executeWith(TaskPool.Submitter submitter) Declare executor service: if null, the tasks are executed in a single thread.onFailure(TaskPool.FailureTask<I, ?> task) Task to invoke on failure.revertWith(TaskPool.Task<I, ?> task) Task to revert with after another task failed.<E extends Exception>
booleanrun(TaskPool.Task<I, E> task) Execute the task across the data.sleepInterval(int value) Set the sleep interval.Stop trying to abort if one operation fails.Stop trying to revert if one operation fails.Suppress exceptions from tasks.suppressExceptions(boolean suppress) Suppress exceptions from tasks.
-
Method Details
-
executeWith
Declare executor service: if null, the tasks are executed in a single thread.- Parameters:
submitter- service to schedule tasks with.- Returns:
- this builder.
-
onFailure
Task to invoke on failure.- Parameters:
task- task- Returns:
- the builder
-
stopOnFailure
-
suppressExceptions
Suppress exceptions from tasks. RemoteIterator exceptions are not suppressable.- Returns:
- the builder.
-
suppressExceptions
Suppress exceptions from tasks. RemoteIterator exceptions are not suppressable.- Parameters:
suppress- new value- Returns:
- the builder.
-
revertWith
Task to revert with after another task failed.- Parameters:
task- task to execute- Returns:
- the builder
-
stopRevertsOnFailure
Stop trying to revert if one operation fails.- Returns:
- the builder
-
abortWith
Task to abort with after another task failed.- Parameters:
task- task to execute- Returns:
- the builder
-
stopAbortsOnFailure
Stop trying to abort if one operation fails.- Returns:
- the builder
-
sleepInterval
Set the sleep interval.- Parameters:
value- new value- Returns:
- the builder
-
run
Execute the task across the data.- Type Parameters:
E- exception which may be raised in execution.- Parameters:
task- task to execute- Returns:
- true if the operation executed successfully
- Throws:
E- any exception raised.IOException- IOExceptions raised by remote iterator or in execution.
-