В java.util.concurrent.atomic.AtomicXXX есть волшебный метод weakCompareAndSet, который отличается от оригинального
compareAndSet двумя моментами:
1) может
spuriously fail "The weak version may be more efficient in the normal case, but differs in that any given invocation of weakCompareAndSetmethod may fail, even spuriously (that is, for no apparent reason)."
2) не устанавливает happend-before отношение "weakCompareAndSet atomically reads and conditionally writes a variable, is ordered with respect to other memory operations on that variable, but otherwise acts as an ordinary non-volatile memory operation."
---
Для такого поведения (второй пункт) найдено пока два Use Case:
A) счетчики
B) Michael-Scott queues (надо попробовать реализовать)
P.S. Как понимаю, j.u.c.ConcurrentLinkedQueue реализовано на основе Michael-Scott queue, но использует "strong" CAS.