@@ -10,7 +10,7 @@ object StashingActor extends Combinators {
10
10
}
11
11
}
12
12
13
- @ deprecated(" Scala Actors are beeing removed from the standard library. Please refer to the migration guide." , " 2.10" )
13
+ @ deprecated(" Scala Actors are being removed from the standard library. Please refer to the migration guide." , " 2.10" )
14
14
trait StashingActor extends InternalActor {
15
15
type Receive = PartialFunction [Any , Unit ]
16
16
@@ -83,9 +83,9 @@ trait StashingActor extends InternalActor {
83
83
* by default it does: EventHandler.warning(self, message)
84
84
*/
85
85
def unhandled (message : Any ) {
86
- println(" unhandeld" )
87
86
message match {
88
- case _ => throw new UnhandledMessageException (message, self)
87
+ case Terminated (dead) ⇒ throw new DeathPactException (dead)
88
+ case _ ⇒ System .err.println(" Unhandeled message " + message)
89
89
}
90
90
}
91
91
@@ -152,7 +152,6 @@ trait StashingActor extends InternalActor {
152
152
def swapExitHandler (pf : PartialFunction [Any , Unit ]) = new PartialFunction [Any , Unit ] {
153
153
def swapExit (v : Any ) = v match {
154
154
case Exit (from, reason) =>
155
-
156
155
Terminated (new InternalActorRef (from.asInstanceOf [InternalActor ]))
157
156
case v => v
158
157
}
@@ -244,18 +243,13 @@ trait StashingActor extends InternalActor {
244
243
}
245
244
246
245
/**
247
- * This message is thrown by default when an Actors behavior doesn't match a message
246
+ * This message is thrown by default when an Actor does not handle termination.
248
247
*/
249
- case class UnhandledMessageException (msg : Any , ref : ActorRef = null ) extends Exception {
250
-
251
- def this (msg : String ) = this (msg, null )
252
-
253
- // constructor with 'null' ActorRef needed to work with client instantiation of remote exception
254
- override def getMessage =
255
- if (ref ne null ) " Actor %s does not handle [%s]" .format(ref, msg)
256
- else " Actor does not handle [%s]" .format(msg)
257
-
248
+ class DeathPactException (ref : ActorRef = null ) extends Exception {
258
249
override def fillInStackTrace () = this // Don't waste cycles generating stack trace
259
250
}
260
251
252
+ /**
253
+ * Message that is sent to a watching actor when the watched actor terminates.
254
+ */
261
255
case class Terminated (actor : ActorRef )
0 commit comments