Call BoundaryEvent cancellation hook for telemetry when ActorGraphInterpreter stops (#30259)

* Call BoundaryEvent cancellation hook for telemetry when ActorGraphInterpreter stops
* Add missing annotation to ActorCell.sendMessage
This commit is contained in:
Yury Gribkov 2021-05-27 11:13:17 -04:00 committed by GitHub
parent 3ae85e8cd0
commit cbb12e6ef3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -322,6 +322,7 @@ private[akka] trait Cell {
* schedule the actor to run, depending on which type of cell it is.
* Is only allowed to throw Fatal Throwables.
*/
@InternalStableApi
final def sendMessage(message: Any, sender: ActorRef): Unit =
sendMessage(Envelope(message, sender, system))

View file

@ -829,7 +829,17 @@ import akka.util.OptionVal
newShells.map(shell => shell.toSnapshot.asInstanceOf[UninitializedInterpreter]))
}
override def postStop(): Unit =
override def postStop(): Unit = {
if (shortCircuitBuffer ne null) {
while (!shortCircuitBuffer.isEmpty) {
shortCircuitBuffer.poll() match {
case b: BoundaryEvent =>
// signal to telemetry that this event won't be processed
b.cancel()
case _ => // ignore
}
}
}
// avoid creating exception in happy case since it uses self.toString which is somewhat slow
if (activeInterpreters.nonEmpty || newShells.nonEmpty) {
val ex = AbruptTerminationException(self)
@ -838,3 +848,4 @@ import akka.util.OptionVal
newShells.foreach(s => if (tryInit(s)) s.tryAbort(ex))
}
}
}