Class TaskPool.Builder<I>

java.lang.Object
org.apache.hadoop.util.functional.TaskPool.Builder<I>
Type Parameters:
I - item type
Enclosing class:
TaskPool

public static class TaskPool.Builder<I> extends Object
Builder for task execution.
  • Method Details

    • executeWith

      public TaskPool.Builder<I> executeWith(@Nullable TaskPool.Submitter submitter)
      Declare executor service: if null, the tasks are executed in a single thread.
      Parameters:
      submitter - service to schedule tasks with.
      Returns:
      this builder.
    • onFailure

      public TaskPool.Builder<I> onFailure(TaskPool.FailureTask<I,?> task)
      Task to invoke on failure.
      Parameters:
      task - task
      Returns:
      the builder
    • stopOnFailure

      public TaskPool.Builder<I> stopOnFailure()
    • suppressExceptions

      public TaskPool.Builder<I> suppressExceptions()
      Suppress exceptions from tasks. RemoteIterator exceptions are not suppressable.
      Returns:
      the builder.
    • suppressExceptions

      public TaskPool.Builder<I> suppressExceptions(boolean suppress)
      Suppress exceptions from tasks. RemoteIterator exceptions are not suppressable.
      Parameters:
      suppress - new value
      Returns:
      the builder.
    • revertWith

      public TaskPool.Builder<I> revertWith(TaskPool.Task<I,?> task)
      Task to revert with after another task failed.
      Parameters:
      task - task to execute
      Returns:
      the builder
    • stopRevertsOnFailure

      public TaskPool.Builder<I> stopRevertsOnFailure()
      Stop trying to revert if one operation fails.
      Returns:
      the builder
    • abortWith

      public TaskPool.Builder<I> abortWith(TaskPool.Task<I,?> task)
      Task to abort with after another task failed.
      Parameters:
      task - task to execute
      Returns:
      the builder
    • stopAbortsOnFailure

      public TaskPool.Builder<I> stopAbortsOnFailure()
      Stop trying to abort if one operation fails.
      Returns:
      the builder
    • sleepInterval

      public TaskPool.Builder<I> sleepInterval(int value)
      Set the sleep interval.
      Parameters:
      value - new value
      Returns:
      the builder
    • run

      public <E extends Exception> boolean run(TaskPool.Task<I,E> task) throws E, IOException
      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.