mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-17 15:50:53 +07:00
11 lines
349 B
Java
11 lines
349 B
Java
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
|
|
|
|
class Atomics {
|
|
private volatile String str;
|
|
private static final AtomicReferenceFieldUpdater<Atomics, String> updater =
|
|
AtomicReferenceFieldUpdater.newUpdater(Atomics.class, String.class, "str");
|
|
|
|
public void init(String s) {
|
|
updater.compareAndSet(this, null, s);
|
|
}
|
|
} |