[concurrency-interest] Parameterized CountedCompleters

Mohan Radhakrishnan radhakrishnan.mohan at gmail.com
Tue Aug 21 04:00:58 EDT 2012


Thanks.. This could be the precedent.
http://threadingbuildingblocks.org/docs/help/reference/task_scheduler.htm


Mohan

On Mon, Aug 20, 2012 at 8:19 PM, Doug Lea <dl at cs.oswego.edu> wrote:

> On 08/20/12 07:35, Mohan Radhakrishnan wrote:
>
>> Hi,
>> I have some questions from the perspective of a programmer using this. for
>> general development. ...
>> Applicability
>> # More well-behaved than RecursiveAction when tasks block ( Is there more
>>
>> explanation for why they are well behaved ? )
>>
>
> Like other completion-based design patterns (google will find some
> descriptions), the main problem they avoid in Future-based programming
> is that if some task1 is blocked in IO, and some other task2
> is joining task1 then task2 is also blocked. Eventually this can
> tie up a lot of tasks/threads. The solution amounts to having task2 ask
> task1 to do whatever task2 would have done after the join --
> task2 is then no longer involved. CountedCompleters add one more
> bit of control versus other completion  frameworks:
> you can ask that a number of other tasks complete, not just
> one, before performing the completion action. This enables recursive,
> tree-style and other uses.
>
>
>
>          public final void compute() {
>>              MasterSocketReceiver msr = new MasterSocketReceiver( new
>> MasterCompleter());
>>              msr.fork();
>>              SlaveSocketReceiver ssr = new SlaveSocketReceiver( new
>> Completer() );
>>              ssr.tryComplete();
>>              System.out.println( "MasterSocketReceiver" );
>>          }
>>      }
>>
>
> I don't offhand understand your intent here, but calling tryComplete
> on some other task is very rarely appropriate.
>
>
> -Doug
> ______________________________**_________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.**oswego.edu <Concurrency-interest at cs.oswego.edu>
> http://cs.oswego.edu/mailman/**listinfo/concurrency-interest<http://cs.oswego.edu/mailman/listinfo/concurrency-interest>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20120821/40cd8129/attachment.html>


More information about the Concurrency-interest mailing list