T - The generic type of the values returned by the Callable
tasks.public class ExecutionHelper<T> extends Object
Callable tasks on
an ExecutorService.| Constructor and Description |
|---|
ExecutionHelper(ExecutorService service)
Tasks will execute without timeout.
|
ExecutionHelper(ExecutorService service,
long timeout,
TimeUnit unit)
Tasks will execute with the specified timeout.
|
| Modifier and Type | Method and Description |
|---|---|
void |
submitTasks(List<Callable<T>> tasks)
Submit subquery tasks, wait until they are done, and verify that all
tasks were executed without error.
|
public ExecutionHelper(ExecutorService service)
service - The service on which the tasks will be executed.public ExecutionHelper(ExecutorService service, long timeout, TimeUnit unit)
service - The service on which the tasks will be executed.timeout - The timeout for the tasks when submitted.unit - The unit in which that timeout is expressed.public void submitTasks(List<Callable<T>> tasks) throws InterruptedException, ExecutionExceptions
ExecutorService has been shutdown.tasks - The tasks.InterruptedException - Tasks that are interrupted and tasks that are canceled due
to timeout result in a logged warning and a thrown
InterruptedException. Likewise, if a
RejectedExecutionException is thrown and the service
is shutdown, then that exception is converted into an
InterruptedException.RejectedExecutionException - If a RejectedExecutionException is thrown and the
executor service has not been shutdown.ExecutionExceptions - If one or more tasks fails. The causes thrown by the various
tasks are available as an aid to debugging.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.