Incorporate review feedback. See #2061

This commit is contained in:
Patrik Nordwall 2012-05-21 07:46:48 +02:00
parent 8924080017
commit 1e82a231c9
2 changed files with 11 additions and 4 deletions

View file

@ -73,13 +73,19 @@ class MyMessageQueue(_owner: ActorContext)
def dequeue(): Envelope = {
val data: Option[Array[Byte]] = storage.pull()
data.map(deserialize(_)).getOrElse(null)
data.map(deserialize).orNull
}
def hasMessages: Boolean = !storage.isEmpty
def numberOfMessages: Int = storage.size
/**
* Called when the mailbox is disposed.
* An ordinary mailbox would send remaining messages to deadLetters,
* but the purpose of a durable mailbox is to continue
* with the same message queue when the actor is started again.
*/
def cleanUp(owner: ActorContext, deadLetters: MessageQueue): Unit = ()
}