[concurrency-interest] ForkJoinPool for async http calls?

Zhong Yu zhong.j.yu at gmail.com
Thu May 10 13:45:25 EDT 2012


On Thu, May 10, 2012 at 12:13 PM, √iktor Ҡlang <viktor.klang at gmail.com> wrote:
>
>
> On Thu, May 10, 2012 at 7:07 PM, Zhong Yu <zhong.j.yu at gmail.com> wrote:
>>
>> On Thu, May 10, 2012 at 10:26 AM, Christian Essl
>> <christianessl at googlemail.com> wrote:
>> > Your are right my primary concern is code-simplicity not pure
>> > performance, basicly writing in a traditional imperative blocking
>> > style but still having IO with (mostly) non-blocking threads (and no
>> > callbacks, no monadic futures).
>>
>> Thread is such a nice programming abstraction, it's a shame that we
>> are so concerned of its overhead nowadays. Replacing simple threads
>> with complex tasks seems to be retrogressing - aren't programming
>> supposed to become easier?
>>
>> What are the fundamental reasons that Java Threads are expensive?
>
>
> Can you give some arguments as to the greatness of proactive programming
> (threads)?

It just seems straightforward to me to write and read

    for(i=0;i<10;i++)
    {
        result = db.query( q[i] );  // blocking
        s = format(result);
        out.write( s );  // blocking
    }
    out.write("done") // blocking

Now convert it to async style - it's not rocket science hard, but at
least it's quite a chore.

Zhong Yu



More information about the Concurrency-interest mailing list