Class 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 Detail

      • IterativeWorkerTaskFactory

        public IterativeWorkerTaskFactory​(Iterable<? extends T> iterable)
    • Method Detail

      • createTasks

        public List<Callable<Void>> createTasks​(int threadPoolSize)
        Specified by:
        createTasks in interface org.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)
      • getQueue

        public Queue<T> getQueue()