public long getAndSet ( T obj , long newValue ) { long prev ; do { prev = get ( obj ) ; } while ( ! compareAndSet ( obj , prev , newValue ) ) ; return prev ; }
Atomically sets the field of the given object managed by this updater to the given value and returns the old value .