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
static interface ExecutorServices.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
 ExecutorService getTaskExecutor()
           
<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 calling ExecutorServices.TaskFactory.createTasks(int) method.
 
Methods inherited from interface org.jboss.weld.bootstrap.api.Service
cleanup
 

Method Detail

getTaskExecutor

ExecutorService getTaskExecutor()

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.

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 calling ExecutorServices.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.

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.


Copyright © 2008-2012 Seam Framework. All Rights Reserved.