Review comments. See #1717

This commit is contained in:
Patrik Nordwall 2012-01-31 08:34:17 +01:00
parent 0c4e6cbe1d
commit 6fbd72591e

View file

@ -287,10 +287,9 @@ trait Actor {
* For Akka internal use only.
*/
private[akka] final def apply(msg: Any) = {
msg match {
case msg if behaviorStack.head.isDefinedAt(msg) behaviorStack.head.apply(msg)
case unknown unhandled(unknown)
}
// TODO would it be more efficient to assume that most messages are matched and catch MatchError instead of using isDefinedAt?
val head = behaviorStack.head
if (head.isDefinedAt(msg)) head.apply(msg) else unhandled(msg)
}
/**
@ -312,7 +311,8 @@ trait Actor {
/**
* For Akka internal use only.
*/
private[akka] def clearBehaviorStack(): Unit = Stack.empty[Receive].push(behaviorStack.last)
private[akka] def clearBehaviorStack(): Unit =
behaviorStack = Stack.empty[Receive].push(behaviorStack.last)
private var behaviorStack: Stack[Receive] = Stack.empty[Receive].push(receive)
}