He-Pin commented on code in PR #3334:
URL: https://github.com/apache/pekko/pull/3334#discussion_r3622027273
##########
actor/src/main/scala/org/apache/pekko/actor/dungeon/ReceiveTimeout.scala:
##########
@@ -22,63 +22,83 @@ import pekko.actor.Cancellable
import pekko.actor.NotInfluenceReceiveTimeout
private[pekko] object ReceiveTimeout {
- final val emptyReceiveTimeoutData: (Duration, Cancellable) =
(Duration.Undefined, ActorCell.emptyCancellable)
+ // Compared only across one message invocation, so wrapping over an actor's
lifetime is harmless.
+ private final class State(var timeout: Duration, var task: Cancellable, var
version: Int)
}
private[pekko] trait ReceiveTimeout { this: ActorCell =>
import ActorCell._
import ReceiveTimeout._
- private var receiveTimeoutData: (Duration, Cancellable) =
emptyReceiveTimeoutData
+ private var receiveTimeoutData: State = _
Review Comment:
Used explicit `null` instead. `scala.compiletime.uninitialized` is Scala 3
only and this file lives in the shared `src/main/scala/` directory which must
cross-compile with Scala 2.13. Explicit `null` is clearer than `= _` and works
on both versions.
--
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]