[concurrency-interest] Concurrency-interest Digest, Vol 35, Issue 20

David J. Biesack David.Biesack at sas.com
Mon Dec 17 09:14:02 EST 2007


> From: concurrency-interest-request at cs.oswego.edu
> Date: Sat, 15 Dec 2007 12:00:00 -0500
> Date: Sat, 15 Dec 2007 11:35:50 -0500
> From: Doug Lea <dl at cs.oswego.edu>
> Subject: Re: [concurrency-interest] ForkJoinExecutor.invoke   and
>       ForkJoinTask.invoke
> To: Tim Peierls <tim at peierls.net>
> Cc: Concurrency Interest <concurrency-interest at cs.oswego.edu>
> Message-ID: <47640266.40804 at cs.oswego.edu>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Tim Peierls wrote:
> > 
> > I still think renaming FJTask.invoke() to forkJoin() would make this 
> > framework slightly easier to learn and reduce the potential for 
> > confusion with FJPool.invoke(task). 
> 
> At first this name sounded too wrong to me -- shouldn't it be
> forkAndJoin()? (precedent: atomic.getAndAdd()) Which itself
> sounds odd.  But just forkJoin() is somehow now starting to sound
> OK to me, and you are right that it may forestall
> some confusion. Any other opinions?

My humble opinion concurs; I prefer forkJoin() over invoke(), avoiding what I also think will be inevitable confusion.

And to really mix things up, I agree forkAndJoin sounds a little wrong. I think forkThenJoin would be slightly better than forkAndJoin because "then" implies sequentiality, whereas "and" can be interpreted as "concurrently". Other examples of "X Then Y" are org.apache.log4j.lf5.util.StreamUtils.copyThenClose() and org.apache.batik.swing.svg.JSVGComponent.stopThenRun()

Side note: In addition to getAndAdd, the name pattern "X And Y" has other precedent: invokeAndWait() in java.awt.EventQueue.invokeAndWait(Runnable) and javax.swing.SwingUtilities(Runnable). Unfortunately, the name invokeAndWait would be confusing here since it may imply "fork() followed by wait()" which is wrong (i.e. invokeAndWait() was poorly named). 

> -Doug

-- 
David J. Biesack     SAS Institute Inc.
(919) 531-7771       SAS Campus Drive
http://www.sas.com   Cary, NC 27513



More information about the Concurrency-interest mailing list