Replace synchronized on AtomicReference and CAS operation