Package org.jboss.weld.manager.api
Interface ExecutorServices
-
- All Superinterfaces:
Service
public interface ExecutorServices extends 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
Nested Classes Modifier and Type Interface Description static interfaceExecutorServices.TaskFactory<T>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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ExecutorServicegetTaskExecutor()default ScheduledExecutorServicegetTimerExecutor()Returns a new ScheduledExecutorService instance which will be used for asynchronous observer notification timeout.<T> List<Future<T>>invokeAllAndCheckForExceptions(Collection<? extends Callable<T>> tasks)Executes the given tasks and blocks until they all finish.<T> List<Future<T>>invokeAllAndCheckForExceptions(ExecutorServices.TaskFactory<T> factory)Executes all the tasks returned from callingExecutorServices.TaskFactory.createTasks(int)method.
-
-
-
Method Detail
-
getTaskExecutor
ExecutorService getTaskExecutor()
-
getTimerExecutor
default ScheduledExecutorService 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
<T> List<Future<T>> invokeAllAndCheckForExceptions(Collection<? extends Callable<T>> tasks)
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
<T> List<Future<T>> invokeAllAndCheckForExceptions(ExecutorServices.TaskFactory<T> factory)
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.
-
-