[concurrency-interest] CallerRunsOrRejects for JDK8?

√iktor Ҡlang viktor.klang at gmail.com
Sat May 12 13:05:35 EDT 2012

On Sat, May 12, 2012 at 6:59 PM, Aleksey Shipilev <
aleksey.shipilev at gmail.com> wrote:

> On Sat, May 12, 2012 at 8:39 PM, √iktor Ҡlang <viktor.klang at gmail.com>
> wrote:
> > How about this for inclusion in JDK8?
> +1
> I also sometimes miss CallerBlocks policy, which:
>  - throws RejectedExecutionException when pool is shutting down
>  - blocks until executor accepts the task, and returns after successful
> submit
> This is helpful when I specifically don't want submitter to execute
> tasks slated to be executed in the threadpool (i.e. CallerRuns is not
> something I want). It was especially problematic when the task at hand
> is rather heavy, and by the time submitter is done executing the task,
> threadpool is had been long idle already, because submitter is, well,
> blocked.

Yup, in my experience, I don't see any situation where you'd like
CallerRunsPolicy, as it just silently drops tasks when TPE isShutdown.

As a sidenote, it'd be nice to have an AsyncExecutor, which is never
allowed to do caller-runs at all. Some code might rely on the block not
being executed on submission.


> -Aleksey.

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/20120512/99edfa17/attachment.html>

More information about the Concurrency-interest mailing list