You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Timothee Maret (JIRA)" <ji...@apache.org> on 2012/07/18 15:14:33 UTC

[jira] [Updated] (SLING-2540) Allow the ThreadPool to process Callable/Runnable and return a Future

     [ https://issues.apache.org/jira/browse/SLING-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothee Maret updated SLING-2540:
----------------------------------

    Attachment: SLING-2540.patch

The patch adds the following methods to ThreadPool:

* <T> Future<T> submit(Callable<T> callable);
* Future<?> submit(Runnable runnable);

Please adjust the dependencies in the pom.xml.
                
> Allow the ThreadPool to process Callable/Runnable and return a Future
> ---------------------------------------------------------------------
>
>                 Key: SLING-2540
>                 URL: https://issues.apache.org/jira/browse/SLING-2540
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons
>    Affects Versions: Commons Threads 3.1.0
>            Reporter: Timothee Maret
>         Attachments: SLING-2540.patch
>
>
> Currently the sling's ThreadPool [0] is not returning a Future when executing a task.
> However, having a handle on the future result of the computation is useful for cases requiring fine grained synchronization among tasks.
> For instance, one could 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
> This could be easily implemented based on the Future objects returned by the ThreadPool.
> Thus, it would be nice to enable it.
> [0] org.apache.sling.commons.threads.ThreadPool

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira