[concurrency-interest] Adding ForkJoinPool.setPoolSizeLimit

√iktor Ҡlang viktor.klang at gmail.com
Thu Jan 12 09:57:21 EST 2012

Hey Doug,

a couple of quick questions:

1) Should there be any possible backpressure for the FJP?
2) What's the current behavior for submissions during shutdown?


On Thu, Jan 12, 2012 at 3:37 PM, Doug Lea <dl at cs.oswego.edu> wrote:

> A series of early prereleases of ForkJoinPool included some
> configuration methods/options similar to those of ThreadPoolExecutor.
> But we found that setting them almost never did anything
> sensible, so they were removed. The main reason is that
> the pool must be able to create "continuation" threads to
> avoid starvation when tasks become blocked on joins;
> any dynamic configuration changes that interfere with this
> can lead to either starvation or runaway growth, and there's
> pretty much nothing users can do about it until it is too late.
> However, there are some legitimate use cases for supporting
> some advisory dynamic resource control. So I'm contemplating
> adding the following. Opinions are welcome from those of you who
> have come up against a situation where this kind of control,
> or something else, would be necessary or helpful.
>    /**
>     * Sets the limit for the number of worker threads created when
>     * new tasks or subtasks become available to execute. This value
>     * may be either less than or greater than the parallelism level
>     * (but at least 1 and at most an implementation-defined capacity
>     * serving as the default value). Setting this value need not
>     * immediately decrease or increase the pool size, but will
>     * gradually take effect as new threads are needed or existing
>     * threads complete tasks. Setting to a value too low to
>     * accommodate the minimum required parallelism of a set of
>     * dependent tasks may cause starvation -- all processing may
>     * stall indefinitely. But assuming this constraint is met, using
>     * setPoolSizeLimit may be preferable to constructing a
>     * ForkJoinPool with non-default parallelism value.
>     *
>     * @param limit the new target limit
>     * @throws IllegalArgumentException if limit is less than one
>     * or greater than this implementation's maximum capacity.
>     */
>    public void setPoolSizeLimit(int limit) { ...
> ______________________________**_________________
> 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>

Viktor Klang

Akka Tech Lead
Typesafe <http://www.typesafe.com/> - The software stack for applications
that scale

Twitter: @viktorklang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20120112/5c3b56a2/attachment.html>

More information about the Concurrency-interest mailing list