He-Pin commented on code in PR #627:
URL: https://github.com/apache/incubator-pekko/pull/627#discussion_r1337127037


##########
stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala:
##########
@@ -1402,8 +1402,7 @@ private[stream] object Collect {
     new GraphStageLogic(shape) with InHandler with OutHandler {
       override def toString = s"MapAsyncUnordered.Logic(inFlight=$inFlight, 
buffer=$buffer)"
 
-      private val decider =
-        inheritedAttributes.mandatoryAttribute[SupervisionStrategy].decider
+      private lazy val decider = 
inheritedAttributes.mandatoryAttribute[SupervisionStrategy].decider

Review Comment:
   1. `def` will do recaculation, and that should be avoid.
   2. `lazy val` will only do synchronization the first time, and the 
supervision strategy method is expected to be quick for calculation, so even't 
the undering Thread is a VirtualThread, it will not cause any problem either.



-- 
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