mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-04 04:09:09 +07:00
Java: Take into account writes to the field done via AtomicFieldUpdater (IDEA-152262)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
|
||||
|
||||
class Atomics {
|
||||
private volatile long num;
|
||||
private static final AtomicLongFieldUpdater<Atomics> updater =
|
||||
(AtomicLongFieldUpdater.newUpdater(Atomics.class, "num"));
|
||||
|
||||
public void init(long n) {
|
||||
updater.compareAndSet(this, 0, n);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user