Fixes after merge

This commit is contained in:
Endre Sándor Varga 2013-03-22 13:36:09 +01:00
parent f8c3717ca1
commit 0f432e38be
7 changed files with 30 additions and 36 deletions

View file

@ -243,7 +243,7 @@ object SupervisorHierarchySpec {
if (failed || suspended) {
listener ! ErrorLog("not resumed (" + failed + ", " + suspended + ")", log)
val state = stateCache.get(self)
stateCache.put(self.path, state.copy(log = log))
if (state ne null) stateCache.put(self.path, state.copy(log = log))
} else {
stateCache.put(self.path, HierarchyState(log, Map(), null))
}

View file

@ -18,9 +18,9 @@ class SystemMessageListSpec extends AkkaSpec {
}
"able to append messages" in {
val create0 = Create(0)
val create1 = Create(1)
val create2 = Create(2)
val create0 = Failed(null, null, 0)
val create1 = Failed(null, null, 1)
val create2 = Failed(null, null, 2)
((create0 :: LNil).head eq create0) must be(true)
((create1 :: create0 :: LNil).head eq create1) must be(true)
((create2 :: create1 :: create0 :: LNil).head eq create2) must be(true)
@ -31,9 +31,9 @@ class SystemMessageListSpec extends AkkaSpec {
}
"able to deconstruct head and tail" in {
val create0 = Create(0)
val create1 = Create(1)
val create2 = Create(2)
val create0 = Failed(null, null, 0)
val create1 = Failed(null, null, 1)
val create2 = Failed(null, null, 2)
val list = create2 :: create1 :: create0 :: LNil
(list.head eq create2) must be(true)
@ -43,9 +43,9 @@ class SystemMessageListSpec extends AkkaSpec {
}
"properly report size and emptyness" in {
val create0 = Create(0)
val create1 = Create(1)
val create2 = Create(2)
val create0 = Failed(null, null, 0)
val create1 = Failed(null, null, 1)
val create2 = Failed(null, null, 2)
val list = create2 :: create1 :: create0 :: LNil
list.size must be === 3
@ -63,9 +63,9 @@ class SystemMessageListSpec extends AkkaSpec {
}
"properly reverse contents" in {
val create0 = Create(0)
val create1 = Create(1)
val create2 = Create(2)
val create0 = Failed(null, null, 0)
val create1 = Failed(null, null, 1)
val create2 = Failed(null, null, 2)
val list = create2 :: create1 :: create0 :: LNil
val listRev: EarliestFirstSystemMessageList = list.reverse
@ -87,12 +87,12 @@ class SystemMessageListSpec extends AkkaSpec {
"EarliestFirstSystemMessageList" must {
"properly prepend reversed message lists to the front" in {
val create0 = Create(0)
val create1 = Create(1)
val create2 = Create(2)
val create3 = Create(3)
val create4 = Create(4)
val create5 = Create(5)
val create0 = Failed(null, null, 0)
val create1 = Failed(null, null, 1)
val create2 = Failed(null, null, 2)
val create3 = Failed(null, null, 3)
val create4 = Failed(null, null, 4)
val create5 = Failed(null, null, 5)
val fwdList = create3 :: create4 :: create5 :: ENil
val revList = create2 :: create1 :: create0 :: LNil

View file

@ -333,7 +333,7 @@ class SerializationCompatibilitySpec extends AkkaSpec(SerializationTests.mostlyR
String.valueOf(encodeHex(ser.serialize(obj, obj.getClass).get)) must be(asExpected)
"be preserved for the Create SystemMessage" in {
verify(Create(), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e0001787073720014616b6b612e64697370617463682e437265617465000000000000000302000078707671007e0003")
verify(Create(), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e000178707372001b616b6b612e64697370617463682e7379736d73672e437265617465bcdf9f7f2675038d02000078707671007e0003")
}
"be preserved for the Recreate SystemMessage" in {
verify(Recreate(null), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e000178707372001d616b6b612e64697370617463682e7379736d73672e52656372656174650987c65c8d378a800200014c000563617573657400154c6a6176612f6c616e672f5468726f7761626c653b7870707671007e0003")
@ -348,7 +348,7 @@ class SerializationCompatibilitySpec extends AkkaSpec(SerializationTests.mostlyR
verify(Terminate(), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e000178707372001e616b6b612e64697370617463682e7379736d73672e5465726d696e61746509d66ca68318700f02000078707671007e0003")
}
"be preserved for the Supervise SystemMessage" in {
verify(Supervise(FakeActorRef("child"), true), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e0001787073720017616b6b612e64697370617463682e53757065727669736500000000000000030200025a00056173796e634c00056368696c647400154c616b6b612f6163746f722f4163746f725265663b7870017372001f616b6b612e73657269616c697a6174696f6e2e46616b654163746f7252656600000000000000010200014c00046e616d657400124c6a6176612f6c616e672f537472696e673b7872001b616b6b612e6163746f722e496e7465726e616c4163746f725265660d0aa2ca1e82097602000078720013616b6b612e6163746f722e4163746f72526566c3585dde655f469402000078707400056368696c647671007e0003")
verify(Supervise(FakeActorRef("child"), true), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e000178707372001e616b6b612e64697370617463682e7379736d73672e5375706572766973652d0b363f56ab5feb0200025a00056173796e634c00056368696c647400154c616b6b612f6163746f722f4163746f725265663b7870017372001f616b6b612e73657269616c697a6174696f6e2e46616b654163746f7252656600000000000000010200014c00046e616d657400124c6a6176612f6c616e672f537472696e673b7872001b616b6b612e6163746f722e496e7465726e616c4163746f72526566db6eaed9e69a356302000078720013616b6b612e6163746f722e4163746f72526566c3585dde655f469402000078707400056368696c647671007e0003")
}
"be preserved for the ChildTerminated SystemMessage" in {
verify(ChildTerminated(FakeActorRef("child")), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e0001787073720024616b6b612e64697370617463682e7379736d73672e4368696c645465726d696e617465644c84222437ed5db40200014c00056368696c647400154c616b6b612f6163746f722f4163746f725265663b78707372001f616b6b612e73657269616c697a6174696f6e2e46616b654163746f7252656600000000000000010200014c00046e616d657400124c6a6176612f6c616e672f537472696e673b7872001b616b6b612e6163746f722e496e7465726e616c4163746f72526566db6eaed9e69a356302000078720013616b6b612e6163746f722e4163746f72526566c3585dde655f469402000078707400056368696c647671007e0003")

View file

@ -8,22 +8,16 @@ import akka.actor.dungeon.ChildrenContainer
import akka.dispatch.Envelope
import akka.dispatch.NullMessage
import akka.dispatch.sysmsg._
import akka.event.Logging.Debug
import akka.event.Logging.{ LogEvent, Error }
import akka.dispatch.sysmsg.{ Watch, Unwatch, Terminate, SystemMessage, Suspend, Supervise, Resume, Recreate, NoMessage, Create, ChildTerminated }
import akka.event.Logging.{ LogEvent, Debug, Error }
import akka.japi.Procedure
import java.io.{ ObjectOutputStream, NotSerializableException }
import scala.annotation.{ switch, tailrec }
import scala.collection.immutable
import scala.concurrent.ExecutionContext
import scala.concurrent.duration.Duration
import scala.concurrent.forkjoin.ThreadLocalRandom
import scala.util.control.NonFatal
import akka.actor.dungeon.ChildrenContainer
import akka.actor.dungeon.ChildrenContainer.WaitingForChildren
import akka.dispatch.{ Watch, Unwatch, Terminate, SystemMessage, Suspend, Supervise, Resume, Recreate, NoMessage, MessageDispatcher, Envelope, Create, ChildTerminated }
import akka.event.Logging.{ LogEvent, Debug, Error }
import akka.japi.Procedure
import akka.dispatch.NullMessage
import scala.concurrent.ExecutionContext
/**
* The actor context - the view of the actor cell from the actor.
@ -430,14 +424,14 @@ private[akka] class ActorCell(
message match {
case message: SystemMessage if shouldStash(message, currentState) stash(message)
case f: Failed handleFailure(f)
case Create() create(uid)
case Create() create()
case Watch(watchee, watcher) addWatcher(watchee, watcher)
case Unwatch(watchee, watcher) remWatcher(watchee, watcher)
case Recreate(cause) faultRecreate(cause)
case Suspend() faultSuspend()
case Resume(inRespToFailure) faultResume(inRespToFailure)
case Terminate() terminate()
case Supervise(child, async) supervise(child, async, uid)
case Supervise(child, async) supervise(child, async)
case ChildTerminated(child) handleChildTerminated(child)
case NoMessage // only here to suppress warning
}

View file

@ -397,7 +397,7 @@ class LocalActorRefProvider private[akka] (
override def sendSystemMessage(message: SystemMessage): Unit = stopped ifOff {
message match {
case Failed(child, ex, _) { causeOfTermination = Some(ex); child.asInstanceOf[InternalActorRef].stop() }
case Supervise(_, _) // TODO register child in some map to keep track of it and enable shutdown after all dead
case Supervise(_, _) // TODO register child in some map to keep track of it and enable shutdown after all dead
case ChildTerminated(_) stop()
case _ log.error(this + " received unexpected system message [" + message + "]")
}

View file

@ -54,7 +54,7 @@ private[akka] trait Dispatch { this: ActorCell ⇒
if (sendSupervise) {
// ➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
parent.sendSystemMessage(akka.dispatch.sysmsg.Supervise(self, async = false, uid))
parent.sendSystemMessage(akka.dispatch.sysmsg.Supervise(self, async = false))
parent ! NullMessage // read ScalaDoc of NullMessage to see why
}
this

View file

@ -201,7 +201,7 @@ trait StashWhenFailed
* INTERNAL API
*/
@SerialVersionUID(-4836972106317757555L)
private[akka] case class Create(uid: Int) extends SystemMessage // send to self from Dispatcher.register
private[akka] case class Create() extends SystemMessage // send to self from Dispatcher.register
/**
* INTERNAL API
*/
@ -226,7 +226,7 @@ private[akka] case class Terminate() extends SystemMessage // sent to self from
* INTERNAL API
*/
@SerialVersionUID(3245747602115485675L)
private[akka] case class Supervise(child: ActorRef, async: Boolean, uid: Int) extends SystemMessage // sent to supervisor ActorRef from ActorCell.start
private[akka] case class Supervise(child: ActorRef, async: Boolean) extends SystemMessage // sent to supervisor ActorRef from ActorCell.start
/**
* INTERNAL API
*/