Introduce onDeadLetterMailboxEnqueue hook for telemetry (#30279)
It's needed for better instrumentation stability in future versions.
This commit is contained in:
parent
258bac491b
commit
c31c114e7b
1 changed files with 8 additions and 4 deletions
|
|
@ -16,6 +16,7 @@ import com.typesafe.config.{ Config, ConfigFactory }
|
||||||
|
|
||||||
import akka.ConfigurationException
|
import akka.ConfigurationException
|
||||||
import akka.actor.{ Actor, ActorRef, ActorSystem, DeadLetter, Deploy, DynamicAccess, Props }
|
import akka.actor.{ Actor, ActorRef, ActorSystem, DeadLetter, Deploy, DynamicAccess, Props }
|
||||||
|
import akka.annotation.InternalStableApi
|
||||||
import akka.dispatch.sysmsg.{
|
import akka.dispatch.sysmsg.{
|
||||||
EarliestFirstSystemMessageList,
|
EarliestFirstSystemMessageList,
|
||||||
LatestFirstSystemMessageList,
|
LatestFirstSystemMessageList,
|
||||||
|
|
@ -41,10 +42,7 @@ private[akka] class Mailboxes(
|
||||||
import Mailboxes._
|
import Mailboxes._
|
||||||
|
|
||||||
val deadLetterMailbox: Mailbox = new Mailbox(new MessageQueue {
|
val deadLetterMailbox: Mailbox = new Mailbox(new MessageQueue {
|
||||||
def enqueue(receiver: ActorRef, envelope: Envelope): Unit = envelope.message match {
|
def enqueue(receiver: ActorRef, envelope: Envelope): Unit = onDeadLetterMailboxEnqueue(receiver, envelope)
|
||||||
case _: DeadLetter => // actor subscribing to DeadLetter, drop it
|
|
||||||
case msg => deadLetters.tell(DeadLetter(msg, envelope.sender, receiver), envelope.sender)
|
|
||||||
}
|
|
||||||
def dequeue() = null
|
def dequeue() = null
|
||||||
def hasMessages = false
|
def hasMessages = false
|
||||||
def numberOfMessages = 0
|
def numberOfMessages = 0
|
||||||
|
|
@ -57,6 +55,12 @@ private[akka] class Mailboxes(
|
||||||
def hasSystemMessages = false
|
def hasSystemMessages = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@InternalStableApi
|
||||||
|
private[akka] def onDeadLetterMailboxEnqueue(receiver: ActorRef, envelope: Envelope): Unit = envelope.message match {
|
||||||
|
case _: DeadLetter => // actor subscribing to DeadLetter, drop it
|
||||||
|
case msg => deadLetters.tell(DeadLetter(msg, envelope.sender, receiver), envelope.sender)
|
||||||
|
}
|
||||||
|
|
||||||
private val mailboxTypeConfigurators = new ConcurrentHashMap[String, MailboxType]
|
private val mailboxTypeConfigurators = new ConcurrentHashMap[String, MailboxType]
|
||||||
|
|
||||||
private val mailboxBindings: Map[Class[_ <: Any], String] = {
|
private val mailboxBindings: Map[Class[_ <: Any], String] = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue