[concurrency-interest] CallerRunsOrRejects for JDK8?

√iktor Ҡlang viktor.klang at gmail.com
Sat May 12 12:39:49 EDT 2012


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)
class CallerRunsOrRejects extends RejectedExecutionHandler {
  def rejectedExecution(runnable: Runnable, threadPoolExecutor:
ThreadPoolExecutor): Unit = {
    if (threadPoolExecutor.isShutdown) throw new
    else runnable.run()


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/43107923/attachment.html>

More information about the Concurrency-interest mailing list