diff options
Diffstat (limited to 'src/actors/scala/actors/ReactorTask.scala')
-rw-r--r-- | src/actors/scala/actors/ReactorTask.scala | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/src/actors/scala/actors/ReactorTask.scala b/src/actors/scala/actors/ReactorTask.scala deleted file mode 100644 index 1ca061b40d..0000000000 --- a/src/actors/scala/actors/ReactorTask.scala +++ /dev/null @@ -1,74 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2005-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - - -package scala.actors - -import java.lang.Runnable -import java.util.concurrent.Callable - -import scala.concurrent.forkjoin.RecursiveAction - -/** - * @author Philipp Haller - */ -private[actors] class ReactorTask[Msg >: Null](var reactor: Reactor[Msg], - var fun: () => Any, - var handler: PartialFunction[Msg, Any], - var msg: Msg) - extends RecursiveAction with Callable[Unit] with Runnable { - - def run() { - try { - beginExecution() - try { - if (fun eq null) - handler(msg) - else - fun() - } catch { - case _: KillActorControl => - // do nothing - - case e: Exception if reactor.exceptionHandler.isDefinedAt(e) => - reactor.exceptionHandler(e) - } - reactor.kill() - } - catch { - case _: SuspendActorControl => - // do nothing (continuation is already saved) - - case e: Throwable => - terminateExecution(e) - reactor.terminated() - if (!e.isInstanceOf[Exception]) - throw e - } finally { - suspendExecution() - this.reactor = null - this.fun = null - this.handler = null - this.msg = null - } - } - - def call() = run() - - def compute() = run() - - protected def beginExecution() {} - - protected def suspendExecution() {} - - protected def terminateExecution(e: Throwable) { - Console.err.println(reactor+": caught "+e) - e.printStackTrace() - } - -} |