improve DeadLetter reporting
(since I know now what’s causing these Jenkins failures ;-) ) - include recipient in DeadLetter - include recipient in calls to enqueue/systemEnqueue - move DeadLetterMailbox to ActorSystem (saves some space, too) - hook up DeadLetterMailbox so it sends DeadLetters to app.deadLetters, which publishes them on the eventStream - subscribe TestEventListener to DeadLetter and turn it into Warning The generated warnings about ChildTerminated are very much correct, they remind us that we still need to fix supervisor.stop() to await all children’s death before actually committing suicide.
This commit is contained in:
parent
85e37ea8ef
commit
1ba168774f
11 changed files with 96 additions and 78 deletions
|
|
@ -100,21 +100,9 @@ abstract class MessageDispatcher(val app: ActorSystem) extends Serializable {
|
|||
protected[akka] def createMailbox(actor: ActorCell): Mailbox
|
||||
|
||||
/**
|
||||
* Create a blackhole mailbox for the purpose of replacing the real one upon actor termination
|
||||
* a blackhole mailbox for the purpose of replacing the real one upon actor termination
|
||||
*/
|
||||
protected[akka] val deadLetterMailbox: Mailbox = DeadLetterMailbox
|
||||
|
||||
object DeadLetterMailbox extends Mailbox(null) {
|
||||
becomeClosed()
|
||||
override def dispatcher = null //MessageDispatcher.this
|
||||
override def enqueue(envelope: Envelope) = ()
|
||||
override def dequeue() = null
|
||||
override def systemEnqueue(handle: SystemMessage): Unit = ()
|
||||
override def systemDrain(): SystemMessage = null
|
||||
override def hasMessages = false
|
||||
override def hasSystemMessages = false
|
||||
override def numberOfMessages = 0
|
||||
}
|
||||
import app.deadLetterMailbox
|
||||
|
||||
/**
|
||||
* Name of this dispatcher.
|
||||
|
|
@ -225,7 +213,7 @@ abstract class MessageDispatcher(val app: ActorSystem) extends Serializable {
|
|||
// message must be “virgin” before being able to systemEnqueue again
|
||||
val next = message.next
|
||||
message.next = null
|
||||
deadLetterMailbox.systemEnqueue(message)
|
||||
deadLetterMailbox.systemEnqueue(actor.self, message)
|
||||
message = next
|
||||
}
|
||||
}
|
||||
|
|
@ -233,7 +221,7 @@ abstract class MessageDispatcher(val app: ActorSystem) extends Serializable {
|
|||
if (mailBox.hasMessages) {
|
||||
var envelope = mailBox.dequeue
|
||||
while (envelope ne null) {
|
||||
deadLetterMailbox.enqueue(envelope)
|
||||
deadLetterMailbox.enqueue(actor.self, envelope)
|
||||
envelope = mailBox.dequeue
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue