Hi, I think there is currently no better way in Sling, so I guess adding support for Callable to Sling's thread pool would be a good thing
Regards Carsten 2012/7/18 Timothee Maret <[email protected]>: > Hi, > > I would require to execute tasks mixing parallel and sequential execution > (Barrier synchronization). > As an example, we could take the following queue of tasks: > > queue: -->(task1)-->(task2, task3, task4)-->(task5)-->(task6,task7) > > Group of tasks = (task1, …, taskn) > Groups of tasks are executed sequentially > Tasks in a group are executed in parallel > > I could achieve this by wrapping each task in a Callable, submitting them to > an ExecutorService and implementing the barrier synchronization based on the > Future returned by the executor. > However, I noticed the sling's ThreadPool [0] is only processing Runnable (no > Callable) and thus I am wondering if there is a better way to enable this > synchronization in Sling (maybe using event queues). > Otherwise, it would be easy to add the Callable support. > > Regards, > > Timothee. > > [0] org.apache.sling.commons.threads.ThreadPool -- Carsten Ziegeler [email protected]
