pjfanning commented on code in PR #1892: URL: https://github.com/apache/pekko/pull/1892#discussion_r2134001186
########## actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala: ########## @@ -120,13 +120,13 @@ private[pekko] trait Children { this: ActorCell => refs.valuesIterator.foreach(_.stop()) } - @nowarn @volatile private var _nextNameDoNotCallMeDirectly = 0L + private val _nextName = new java.util.concurrent.AtomicLong() Review Comment: I tried AtomicLongFieldUpdater but it doesn't work with private fields. ``` [error] Caused by: java.lang.IllegalAccessException: class example.AbstractActorCell cannot access a member of class example.ActorCell with modifiers "private volatile" ``` I also found in benchmarks that AtomicLong is nearly as fast as the existing code and the code is much simpler to maintain. No reflection, no sun.misc.Unsafe. https://github.com/pjfanning/pekko-bench -- 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: notifications-unsubscr...@pekko.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org For additional commands, e-mail: notifications-h...@pekko.apache.org