[concurrency-interest] Issues with ForkJoin update

Doug Lea dl at cs.oswego.edu
Sun Apr 18 11:35:57 EDT 2010


On 04/16/10 12:36, Doug Lea wrote:
> On 04/16/10 11:26, Denys Geert wrote:
>
>> What's probably atypical about our use case is that we limit the FJ
>> pool (setMaximumPoolSize).
>
> Thanks for reporting this. I'm beginning to regret defining
> a method that allows people to do this ...

I checked in an update that handles max pool size settings for
helpJoin, but also strengthened the wording on setMaximumPoolSize
javadoc to make it clearer that this method is not usually what people
want. It imposes a hard limit rather than providing an overall
thread minimization policy supported by method setMaintainsParallelism.
There are only a few (uncommon) reasonable use cases for
setMaximumPoolSize. But still a few, so I don't think we should
remove it, just discourage it.

Pasting from updated javadoc:

setMaximumPoolSize

public void setMaximumPoolSize(int newMax)

     Sets the maximum number of threads allowed to exist in the pool. The given 
value should normally be greater than or equal to the parallelism level. Setting 
this value has no effect on current pool size. It controls construction of new 
threads. The use of this method may cause tasks that intrinsically require extra 
threads for dependent computations to indefinitely stall. If you are instead 
trying to minimize internal thread creation, consider setting 
setMaintainsParallelism(boolean) as false.

Here are the usual links:

jsr166y:
* API specs:  http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166ydocs/
* jar file: http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166y.jar (compiled using 
Java6 javac).
* Browsable CVS sources: 
http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/jsr166y/

openjdk7-ready java.util.concurrent:
* API specs:  http://gee.cs.oswego.edu/dl/jsr166/dist/docs/
* jar file: http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166.jar
* Browsable CVS sources: 
http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/

-Doug


More information about the Concurrency-interest mailing list