blob: b24a709543512188cb3dfcef0b47368ef64538b1 [file] [log] [blame] [edit]
// Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
package atomicfieldupdater;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
public class Main {
public static void main(String[] args) throws Exception {
A a = new A();
AtomicIntegerFieldUpdater<A> iUpdater = AtomicIntegerFieldUpdater.newUpdater(A.class, "i");
iUpdater.set(a, 8);
AtomicLongFieldUpdater<A> lUpdater = AtomicLongFieldUpdater.newUpdater(A.class, "l");
lUpdater.set(a, 8L);
AtomicReferenceFieldUpdater<A, Object> oUpdater =
AtomicReferenceFieldUpdater.newUpdater(A.class, Object.class, "o");
oUpdater.set(a, null);
}
}