Package org.jboss.weld.executor
Class IterativeWorkerTaskFactory<T>
- java.lang.Object
-
- org.jboss.weld.executor.IterativeWorkerTaskFactory<T>
-
- All Implemented Interfaces:
org.jboss.weld.manager.api.ExecutorServices.TaskFactory<Void>
public abstract class IterativeWorkerTaskFactory<T> extends Object implements org.jboss.weld.manager.api.ExecutorServices.TaskFactory<Void>
Used for decomposition of loops in which independent tasks are processed sequentially. Based on the size of a thread pool, the factory creates an equal number of workers. Each worker iterates on a shared concurrent queue. The queue is created from the source items (iterable).- Author:
- Jozef Hartinger
-
-
Constructor Summary
Constructors Constructor Description IterativeWorkerTaskFactory(Iterable<? extends T> iterable)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
cleanup()
Called after the computation finishes.List<Callable<Void>>
createTasks(int threadPoolSize)
protected abstract void
doWork(T item)
Queue<T>
getQueue()
protected void
init()
Called before the compilation begins.
-
-
-
Method Detail
-
createTasks
public List<Callable<Void>> createTasks(int threadPoolSize)
- Specified by:
createTasks
in interfaceorg.jboss.weld.manager.api.ExecutorServices.TaskFactory<T>
-
init
protected void init()
Called before the compilation begins.
-
cleanup
protected void cleanup()
Called after the computation finishes.
-
doWork
protected abstract void doWork(T item)
-
-