[concurrency-interest] CallerRunsOrRejects for JDK8?
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
>> * 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.
> Concurrency-interest mailing list
> Concurrency-interest at cs.**oswego.edu <Concurrency-interest at cs.oswego.edu>
Akka Tech Lead
Typesafe <http://www.typesafe.com/> - The software stack for applications
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest