He-Pin commented on code in PR #3096:
URL: https://github.com/apache/pekko/pull/3096#discussion_r3444284215


##########
actor/src/main/scala/org/apache/pekko/actor/FSM.scala:
##########
@@ -779,11 +779,32 @@ trait FSM[S, D] extends Actor with Listeners with 
ActorLogging {
    * transition handling
    */
   private var transitionEvent: List[TransitionHandler] = Nil
+  private val watchedListeners: mutable.Set[ActorRef] = mutable.Set.empty
   private def handleTransition(prev: S, next: S): Unit = {
     val tuple = (prev, next)
     for (te <- transitionEvent) { if (te.isDefinedAt(tuple)) te(tuple) }
   }
 
+  private def addListener(actorRef: ActorRef): Unit = {
+    if (listeners.add(actorRef)) {
+      if (!context.asInstanceOf[ActorCell].isWatching(actorRef)) {

Review Comment:
   better with pattern matching



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to