[concurrency-interest] CallerRunsOrRejects for JDK8?

Aleksey Shipilev aleksey.shipilev at gmail.com
Sat May 12 12:59:56 EDT 2012


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.

-Aleksey.



More information about the Concurrency-interest mailing list