[concurrency-interest] CallerRunsOrRejects for JDK8?

√iktor Ҡlang viktor.klang at gmail.com
Sun May 13 06:53:54 EDT 2012

On Sun, May 13, 2012 at 12:41 PM, Doug Lea <dl at cs.oswego.edu> wrote:

> 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.

I don't think we can change it since it's clearly documented in the class
as the specified behavior: "A handler for rejected tasks that runs the
rejected task directly in the calling thread of the execute method, unless
the executor has been shut down, in which case the task is discarded."

So adding a new policy which improves on the situation is probably the
least intrusive solution.


> -Doug
> ______________________________**_________________
> 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/20120513/5db8329c/attachment-0001.html>

More information about the Concurrency-interest mailing list