SirYwell commented on issue #417:
URL: 
https://github.com/apache/incubator-pekko/issues/417#issuecomment-1682335651

   `VarHandle` could replace the usage of `Unsafe` pretty much 1:1. However, 
`VarHandle` is Java 9+.
   
   Looking at the usages, I'm wondering if much of it can be replaced by using 
`AtomicReference` instead. For example, consider 
https://github.com/apache/incubator-pekko/blob/3775a18c2eec1abd46355b656109f282d4115b40/actor/src/main/scala/org/apache/pekko/actor/RepointableActorRef.scala#L62-L80:
   
   To me, the tailrec methods look like overly complicated `getAndSet(...)` 
implementations, and `underlying` and `lookup` are just `get()`s.
   `Unsafe#getAndSetObject` was only added in Java 8, so I assume that's the 
reason it isn't used, but I'm not sure why the code doesn't make use of 
`AtomicReference`. Am I missing something?
   


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