Skip to content

Commit 033463f

Browse files
author
Vojin Jovanovic
committed
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.
1 parent e99fb0c commit 033463f

File tree

4 files changed

+19
-24
lines changed

4 files changed

+19
-24
lines changed

src/actors-migration/scala/actors/Props.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ case class Props(creator: () ⇒ InternalActor, dispatcher: String) {
77

88
/**
99
* Returns a new Props with the specified creator set
10-
* Scala API
1110
*/
1211
def withCreator(c: InternalActor) = copy(creator = () c)
1312

14-
}
13+
}

src/actors-migration/scala/actors/StashingActor.scala

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object StashingActor extends Combinators {
1010
}
1111
}
1212

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")
1414
trait StashingActor extends InternalActor {
1515
type Receive = PartialFunction[Any, Unit]
1616

@@ -83,9 +83,9 @@ trait StashingActor extends InternalActor {
8383
* by default it does: EventHandler.warning(self, message)
8484
*/
8585
def unhandled(message: Any) {
86-
println("unhandeld")
8786
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)
8989
}
9090
}
9191

@@ -152,7 +152,6 @@ trait StashingActor extends InternalActor {
152152
def swapExitHandler(pf: PartialFunction[Any, Unit]) = new PartialFunction[Any, Unit] {
153153
def swapExit(v: Any) = v match {
154154
case Exit(from, reason) =>
155-
156155
Terminated(new InternalActorRef(from.asInstanceOf[InternalActor]))
157156
case v => v
158157
}
@@ -244,18 +243,13 @@ trait StashingActor extends InternalActor {
244243
}
245244

246245
/**
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.
248247
*/
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 {
258249
override def fillInStackTrace() = this //Don't waste cycles generating stack trace
259250
}
260251

252+
/**
253+
* Message that is sent to a watching actor when the watched actor terminates.
254+
*/
261255
case class Terminated(actor: ActorRef)

src/actors-migration/scala/actors/Timeout.scala

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
/**
2-
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
3-
*/
1+
/* __ *\
2+
** ________ ___ / / ___ Scala API **
3+
** / __/ __// _ | / / / _ | (c) 2005-2011, LAMP/EPFL **
4+
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
5+
** /____/\___/_/ |_/____/_/ | | **
6+
** |/ **
7+
\* */
8+
49
package scala.actors
510

611
import scala.concurrent.util.Duration

src/actors/scala/actors/ReplyReactor.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
\* */
88
package scala.actors
99

10-
@deprecated("Scala Actors are beeing removed from the standard library. Please refer to the migration guide.", "2.10")
10+
@deprecated("Scala Actors are being removed from the standard library. Please refer to the migration guide.", "2.10")
1111
trait ReplyReactor extends InternalReplyReactor {
12-
13-
protected[actors] def sender: OutputChannel[Any] = super.internalSender
14-
12+
protected[actors] def sender: OutputChannel[Any] = super.internalSender
1513
}
16-

0 commit comments

Comments
 (0)