Changing so that the mailbox status is ack:ed after the _whole_ processing of the current batch, which means that Akka only does 1 volatile write per batch (of course the backing mailboxes might do their own volatile writes)

This commit is contained in:
Viktor Klang 2011-10-17 19:33:19 +02:00
parent fa1a2610a7
commit 4e960e5364
2 changed files with 4 additions and 5 deletions

View file

@ -443,8 +443,6 @@ private[akka] class ActorCell(
app.eventHandler.error(e, self, "error while processing " + envelope.message)
//TODO FIXME How should problems here be handled?
throw e
} finally {
mailbox.acknowledgeStatus() //Volatile write
}
}
@ -487,8 +485,6 @@ private[akka] class ActorCell(
messageHandle.channel sendException new ActorKilledException("Actor has been stopped")
// throwing away message if actor is shut down, no use throwing an exception in receiving actor's thread, isShutdown is enforced on caller side
}
} finally {
mailbox.acknowledgeStatus()
}
}

View file

@ -128,7 +128,10 @@ abstract class Mailbox extends AbstractMailbox with MessageQueue with SystemMess
*/
if (s >= Scheduled) {
updateStatus(s, s & ~Scheduled) || setAsIdle()
} else false
} else {
acknowledgeStatus() // this write is needed to make memory consistent after processMailbox()
false
}
}
def shouldBeRegisteredForExecution(hasMessageHint: Boolean, hasSystemMessageHint: Boolean): Boolean = status match {