use AtomicReference and CAS