[concurrency-interest] CallerRunsOrRejects for JDK8?

Doug Lea dl at cs.oswego.edu
Sun May 13 06:41:18 EDT 2012

On 05/12/12 12:39, √iktor Ҡlang wrote:
> How about this for inclusion in JDK8?
> /**
>   * The RejectedExecutionHandler used by Akka, it improves on CallerRunsPolicy
>   * by throwing a RejectedExecutionException if the executor isShutdown.
>   * (CallerRunsPolicy silently discards the runnable in this case, which is
> arguably broken)

Yes, it is arguably broken, and a candidate for a bug report.
Surely no user actually wants the task to start if the executor
is already shut down.
The TPE rejection mechanics don't distinguish these cases, so the
CallerRunsPolicy handler ought to have done this from the beginning.
But it's not clear whether we can fix/change this now.
I'll look into it.


More information about the Concurrency-interest mailing list