diff options
-rw-r--r-- | src/actors/scala/actors/Actor.scala | 12 | ||||
-rw-r--r-- | src/actors/scala/actors/FJTaskScheduler2.scala | 5 |
2 files changed, 3 insertions, 14 deletions
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala index 967e5c758b..e332d9fe13 100644 --- a/src/actors/scala/actors/Actor.scala +++ b/src/actors/scala/actors/Actor.scala @@ -28,7 +28,8 @@ object Actor { private[actors] val tl = new ThreadLocal[Actor] - private[actors] var timer = new Timer + // timer thread runs as daemon + private[actors] val timer = new Timer(true) /** * Returns the currently executing actor. Should be used instead @@ -554,18 +555,11 @@ trait Actor extends AbstractActor { } else { waitingFor = f.isDefinedAt - val thisActor = this onTimeout = Some(new TimerTask { def run() { thisActor.send(TIMEOUT, thisActor) } }) - try { - Actor.timer.schedule(onTimeout.get, msec) - } catch { - case ise: IllegalStateException => - Actor.timer = new Timer - Actor.timer.schedule(onTimeout.get, msec) - } + Actor.timer.schedule(onTimeout.get, msec) continuation = f isDetached = true } diff --git a/src/actors/scala/actors/FJTaskScheduler2.scala b/src/actors/scala/actors/FJTaskScheduler2.scala index 096f703ddd..2880a1d9c4 100644 --- a/src/actors/scala/actors/FJTaskScheduler2.scala +++ b/src/actors/scala/actors/FJTaskScheduler2.scala @@ -129,9 +129,6 @@ class FJTaskScheduler2 extends Thread with IScheduler { // the FJTaskRunnerGroup since there is // no separate thread associated with it, // and FJTaskRunner threads have daemon status. - - // terminate timer thread - Actor.timer.cancel() throw new QuitException } } @@ -162,8 +159,6 @@ class FJTaskScheduler2 extends Thread with IScheduler { */ def shutdown(): Unit = synchronized { terminating = true - // terminate timer thread - Actor.timer.cancel() } def snapshot(): LinkedQueue = { |