Package org.apache.drill.exec.store
Class TimedCallable<V>
java.lang.Object
org.apache.drill.exec.store.TimedCallable<V>
- Type Parameters:
V
- The time value that will be returned when the task is executed.
- All Implemented Interfaces:
Callable<V>
Allows parallel executions of tasks in a simplified way. Also maintains and
reports timings of task completion.
TODO: look at switching to fork join.
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
TimedCallable
public TimedCallable()
-
-
Method Details
-
call
-
runInner
- Throws:
Exception
-
run
public static <V> List<V> run(String activity, org.slf4j.Logger logger, List<TimedCallable<V>> tasks, int parallelism) throws IOException Execute the list of runnables with the given parallelization. At end, return values and report completion time stats to provided logger. Each runnable is allowed a certain timeout. If the timeout exceeds, existing/pending tasks will be cancelled and aUserException
is thrown.- Parameters:
activity
- Name of activity for reporting in logger.logger
- The logger to use to report results.tasks
- List of callable that should be executed and timed. If this list has one item, task will be completed in-thread. Each callable must handleInterruptedException
s.parallelism
- The number of threads that should be run to complete this task.- Returns:
- The list of outcome objects.
- Throws:
IOException
- All exceptions are coerced to IOException since this was build for storage system tasks initially.
-