mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-19 01:50:56 +07:00
14 lines
341 B
Java
14 lines
341 B
Java
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);
|
|
}
|
|
} |