[concurrency-interest] atomic references

Dhanji R. Prasanna dhanji at gmail.com
Wed Aug 23 00:06:48 EDT 2006


Ive a bit of an issue with AtomicReference. Semantically all the
atomic wrappers (AtomicInteger, AtomicLong etc.) perform an equals
comparison on a compareAndSet or weakCompareAndSet.

However, it is not clear if AtomicReference performs an == or an
equals() comparison. As we know v1 == v2 can be entirely different
from v1.equals(v2). Can anyone shed some light on which type of
comparison is done?

Furthermore, assuming the former (==), is it not incongruous for
AtomicReference to do a reference comparison while other atomics do a
value comparison (on primitives)? Im curious about this one.



More information about the Concurrency-interest mailing list