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