summaryrefslogtreecommitdiff
path: root/src/actors-migration
diff options
context:
space:
mode:
authorVojin Jovanovic <vojin.jovanovic@epfl.ch>2012-05-23 09:46:21 +0200
committerVojin Jovanovic <vojin.jovanovic@epfl.ch>2012-05-23 09:46:21 +0200
commit033463f87fe71e8f6d5b17f7cb82b8c2ea5f5271 (patch)
tree5cac4d83c5f22ef9b947d6830d2731e7444b2450 /src/actors-migration
parente99fb0c93842d517b8a185458f405bace2bbb46b (diff)
downloadscala-033463f87fe71e8f6d5b17f7cb82b8c2ea5f5271.tar.gz
scala-033463f87fe71e8f6d5b17f7cb82b8c2ea5f5271.tar.bz2
scala-033463f87fe71e8f6d5b17f7cb82b8c2ea5f5271.zip
Minor fixes for the Actor Migration Kit
Fixed behavior of the StashingActor in case of unhandeled message. Fixed a typo in deprecated annotation. Fixed comments. Fixed copyright.
Diffstat (limited to 'src/actors-migration')
-rw-r--r--src/actors-migration/scala/actors/Props.scala3
-rw-r--r--src/actors-migration/scala/actors/StashingActor.scala22
-rw-r--r--src/actors-migration/scala/actors/Timeout.scala11
3 files changed, 17 insertions, 19 deletions
diff --git a/src/actors-migration/scala/actors/Props.scala b/src/actors-migration/scala/actors/Props.scala
index b4d18d5fad..891e23213a 100644
--- a/src/actors-migration/scala/actors/Props.scala
+++ b/src/actors-migration/scala/actors/Props.scala
@@ -7,8 +7,7 @@ case class Props(creator: () ⇒ InternalActor, dispatcher: String) {
/**
* Returns a new Props with the specified creator set
- * Scala API
*/
def withCreator(c: ⇒ InternalActor) = copy(creator = () ⇒ c)
-} \ No newline at end of file
+}
diff --git a/src/actors-migration/scala/actors/StashingActor.scala b/src/actors-migration/scala/actors/StashingActor.scala
index 4bca879d9f..37300f9d63 100644
--- a/src/actors-migration/scala/actors/StashingActor.scala
+++ b/src/actors-migration/scala/actors/StashingActor.scala
@@ -10,7 +10,7 @@ object StashingActor extends Combinators {
}
}
-@deprecated("Scala Actors are beeing removed from the standard library. Please refer to the migration guide.", "2.10")
+@deprecated("Scala Actors are being removed from the standard library. Please refer to the migration guide.", "2.10")
trait StashingActor extends InternalActor {
type Receive = PartialFunction[Any, Unit]
@@ -83,9 +83,9 @@ trait StashingActor extends InternalActor {
* by default it does: EventHandler.warning(self, message)
*/
def unhandled(message: Any) {
- println("unhandeld")
message match {
- case _ => throw new UnhandledMessageException(message, self)
+ case Terminated(dead) ⇒ throw new DeathPactException(dead)
+ case _ ⇒ System.err.println("Unhandeled message " + message)
}
}
@@ -152,7 +152,6 @@ trait StashingActor extends InternalActor {
def swapExitHandler(pf: PartialFunction[Any, Unit]) = new PartialFunction[Any, Unit] {
def swapExit(v: Any) = v match {
case Exit(from, reason) =>
-
Terminated(new InternalActorRef(from.asInstanceOf[InternalActor]))
case v => v
}
@@ -244,18 +243,13 @@ trait StashingActor extends InternalActor {
}
/**
- * This message is thrown by default when an Actors behavior doesn't match a message
+ * This message is thrown by default when an Actor does not handle termination.
*/
-case class UnhandledMessageException(msg: Any, ref: ActorRef = null) extends Exception {
-
- def this(msg: String) = this(msg, null)
-
- // constructor with 'null' ActorRef needed to work with client instantiation of remote exception
- override def getMessage =
- if (ref ne null) "Actor %s does not handle [%s]".format(ref, msg)
- else "Actor does not handle [%s]".format(msg)
-
+class DeathPactException(ref: ActorRef = null) extends Exception {
override def fillInStackTrace() = this //Don't waste cycles generating stack trace
}
+/**
+ * Message that is sent to a watching actor when the watched actor terminates.
+ */
case class Terminated(actor: ActorRef)
diff --git a/src/actors-migration/scala/actors/Timeout.scala b/src/actors-migration/scala/actors/Timeout.scala
index bb3c8c0476..0d9532a14b 100644
--- a/src/actors-migration/scala/actors/Timeout.scala
+++ b/src/actors-migration/scala/actors/Timeout.scala
@@ -1,6 +1,11 @@
-/**
- * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
- */
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2005-2011, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
package scala.actors
import scala.concurrent.util.Duration