Adding ScalaDoc to ThreadPoolBuilder.scala

This commit is contained in:
Viktor Klang 2011-12-28 12:43:28 +01:00
parent 2dffb2b659
commit f8aca9eee5

View file

@ -212,6 +212,11 @@ trait ExecutorServiceDelegate extends ExecutorService {
def invokeAny[T](callables: Collection[_ <: Callable[T]], l: Long, timeUnit: TimeUnit) = executor.invokeAny(callables, l, timeUnit)
}
/**
* 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)
*/
class SaneRejectedExecutionHandler extends RejectedExecutionHandler {
def rejectedExecution(runnable: Runnable, threadPoolExecutor: ThreadPoolExecutor): Unit = {
if (threadPoolExecutor.isShutdown) throw new RejectedExecutionException("Shutdown")