Package org.jboss.weld.manager.api
Interface ExecutorServices
- All Superinterfaces:
Service
Allows a custom TaskExecutor to be provided by the container. By default,
Executors.newSingleThreadExecutor()
is
used.
This is a per-deployment service.- Author:
- Pete Muir, Jozef Hartinger
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Instead of submitting a list of tasks to be executed a caller may submit a factory object capable of creating the list of tasks. -
Method Summary
Modifier and TypeMethodDescriptiondefault ScheduledExecutorService
Returns a new ScheduledExecutorService instance which will be used for asynchronous observer notification timeout.invokeAllAndCheckForExceptions
(Collection<? extends Callable<T>> tasks) Executes the given tasks and blocks until they all finish.Executes all the tasks returned from callingExecutorServices.TaskFactory.createTasks(int)
method.
-
Method Details
-
getTaskExecutor
ExecutorService getTaskExecutor() -
getTimerExecutor
Returns a new ScheduledExecutorService instance which will be used for asynchronous observer notification timeout. Can return null in which case the observer notification timeout feature throws an exception.- Returns:
- ScheduledExecutorService instance or null
- Since:
- 3.0
-
invokeAllAndCheckForExceptions
Executes the given tasks and blocks until they all finish. If a task throws an exception, the exception is rethrown by this method. If multiple tasks throw exceptions, there is no guarantee about which of the exceptions is rethrown by this method.- Type Parameters:
T
- the result type of tasks- Parameters:
tasks
- the collection of tasks- Returns:
- A list of Futures representing the tasks, in the same sequential order as produced by the iterator for the given task list, each of which has completed.
-
invokeAllAndCheckForExceptions
Executes all the tasks returned from callingExecutorServices.TaskFactory.createTasks(int)
method. The method is called exactly once.If a task throws an exception, the exception is rethrown by this method. If multiple tasks throw exceptions, there is no guarantee about which of the exceptions is rethrown by this method.- Type Parameters:
T
- the result type of tasks- Parameters:
factory
- factory capable of creating tasks- Returns:
- A list of Futures representing the tasks, in the same sequential order as produced by the iterator for the given task list, each of which has completed.
-