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


##########
persistence/src/main/scala/org/apache/pekko/persistence/fsm/PersistentFSMBase.scala:
##########
@@ -482,11 +481,32 @@ trait PersistentFSMBase[S, D, E] 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:
   use 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